From d7d7952111ebbba5bff9e4a15ab3198b6fdedad2 Mon Sep 17 00:00:00 2001 From: Christian Neumann Date: Fri, 20 Nov 2020 11:29:57 +0100 Subject: [PATCH 1/3] Wait for loading of AccuratePosition script. --- Logic/Leaflet/GeoLocationHandler.ts | 8 ++++++++ index.html | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Logic/Leaflet/GeoLocationHandler.ts b/Logic/Leaflet/GeoLocationHandler.ts index e94b23e..8950e31 100644 --- a/Logic/Leaflet/GeoLocationHandler.ts +++ b/Logic/Leaflet/GeoLocationHandler.ts @@ -17,6 +17,14 @@ export class GeoLocationHandler extends UIElement { constructor() { super(undefined); this._hasLocation = State.state.currentGPSLocation.map((location) => location !== undefined); + var self = this; + import("../../vendor/Leaflet.AccuratePosition.js").then(() => { + self.init(); + }) + } + + + public init() { this.ListenTo(this._hasLocation); this.ListenTo(this._isActive); this.ListenTo(this._permission); diff --git a/index.html b/index.html index 3751ce6..d74743a 100644 --- a/index.html +++ b/index.html @@ -65,7 +65,6 @@
- From 5134bce714383a1e227f1135ad442f24d8d402c7 Mon Sep 17 00:00:00 2001 From: Christian Neumann Date: Fri, 20 Nov 2020 11:31:11 +0100 Subject: [PATCH 2/3] Increase animation speed, decrease zoom level of fly to location. --- Logic/Leaflet/GeoLocationHandler.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Logic/Leaflet/GeoLocationHandler.ts b/Logic/Leaflet/GeoLocationHandler.ts index 8950e31..a668a5c 100644 --- a/Logic/Leaflet/GeoLocationHandler.ts +++ b/Logic/Leaflet/GeoLocationHandler.ts @@ -114,7 +114,12 @@ export class GeoLocationHandler extends UIElement { return ""; } if (State.state.currentGPSLocation.data !== undefined) { - map.flyTo(State.state.currentGPSLocation.data.latlng, 18); + State.state.bm.map.flyTo( + State.state.currentGPSLocation.data.latlng, 16, + { + duration: 0.25, + } + ); } From fa154b324c6f2372136c818377a3ed320b2e3a89 Mon Sep 17 00:00:00 2001 From: Christian Neumann Date: Fri, 20 Nov 2020 11:31:54 +0100 Subject: [PATCH 3/3] Add scale to map. --- Logic/Leaflet/Basemap.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Logic/Leaflet/Basemap.ts b/Logic/Leaflet/Basemap.ts index a1b09c9..e1139e7 100644 --- a/Logic/Leaflet/Basemap.ts +++ b/Logic/Leaflet/Basemap.ts @@ -42,6 +42,11 @@ export class Basemap { layers: [this._previousLayer], }); + L.control.scale( + { + position: 'topright', + } + ).addTo(this.map) // Users are not allowed to zoom to the 'copies' on the left and the right, stuff goes wrong then // We give a bit of leeway for people on the edges