forked from MapComplete/MapComplete
Add long press behaviour on the geolocate-me button
This commit is contained in:
parent
7edf169003
commit
7ff1e7e348
4 changed files with 15 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue