Add long press behaviour on the geolocate-me button

This commit is contained in:
Pieter Vander Vennet 2020-12-14 00:04:53 +01:00
parent 7edf169003
commit 7ff1e7e348
4 changed files with 15 additions and 6 deletions

View file

@ -103,7 +103,7 @@ export class GeoLocationHandler extends UIElement {
}
private StartGeolocating() {
private StartGeolocating(zoomlevel = 19) {
const self = this;
const map = State.state.bm.map;
if (self._permission.data === "denied") {
@ -111,7 +111,7 @@ export class GeoLocationHandler extends UIElement {
}
if (State.state.currentGPSLocation.data !== undefined) {
State.state.bm.map.setView(
State.state.currentGPSLocation.data.latlng, 16
State.state.currentGPSLocation.data.latlng, zoomlevel
);
}
@ -145,8 +145,15 @@ export class GeoLocationHandler extends UIElement {
const self = this;
htmlElement.onclick = function () {
self.StartGeolocating();
self.StartGeolocating(19);
}
htmlElement.oncontextmenu = function (e) {
self.StartGeolocating(15);
e.preventDefault();
return false;
}
}
}