Merge pull request #160 from chrneumann/fix/location-handler
Fix/location handler
This commit is contained in:
commit
6416536086
3 changed files with 19 additions and 2 deletions
|
@ -42,6 +42,11 @@ export class Basemap {
|
||||||
layers: [this._previousLayer],
|
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
|
// 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
|
// We give a bit of leeway for people on the edges
|
||||||
|
|
|
@ -17,6 +17,14 @@ export class GeoLocationHandler extends UIElement {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(undefined);
|
super(undefined);
|
||||||
this._hasLocation = State.state.currentGPSLocation.map((location) => location !== 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._hasLocation);
|
||||||
this.ListenTo(this._isActive);
|
this.ListenTo(this._isActive);
|
||||||
this.ListenTo(this._permission);
|
this.ListenTo(this._permission);
|
||||||
|
@ -102,7 +110,12 @@ export class GeoLocationHandler extends UIElement {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (State.state.currentGPSLocation.data !== undefined) {
|
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,
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@
|
||||||
<div id="leafletDiv"></div>
|
<div id="leafletDiv"></div>
|
||||||
|
|
||||||
<script src="./index.ts"></script>
|
<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>
|
<script data-goatcounter="https://pietervdvn.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue