Merge pull request #160 from chrneumann/fix/location-handler

Fix/location handler
This commit is contained in:
Pieter Vander Vennet 2020-11-20 14:11:07 +01:00 committed by GitHub
commit 6416536086
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View file

@ -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

View file

@ -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);
@ -102,7 +110,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,
}
);
}

View file

@ -65,7 +65,6 @@
<div id="leafletDiv"></div>
<script src="./index.ts"></script>
<script src="./vendor/Leaflet.AccuratePosition.js"></script>
<script data-goatcounter="https://pietervdvn.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>