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 self = this;
const map = State.state.bm.map; const map = State.state.bm.map;
if (self._permission.data === "denied") { if (self._permission.data === "denied") {
@ -111,7 +111,7 @@ export class GeoLocationHandler extends UIElement {
} }
if (State.state.currentGPSLocation.data !== undefined) { if (State.state.currentGPSLocation.data !== undefined) {
State.state.bm.map.setView( 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; const self = this;
htmlElement.onclick = function () { htmlElement.onclick = function () {
self.StartGeolocating(); self.StartGeolocating(19);
} }
htmlElement.oncontextmenu = function (e) {
self.StartGeolocating(15);
e.preventDefault();
return false;
}
} }
} }

View file

@ -24,7 +24,7 @@ export default class State {
// The singleton of the global state // The singleton of the global state
public static state: State; public static state: State;
public static vNumber = "0.2.5a"; public static vNumber = "0.2.5b";
// The user journey states thresholds when a new feature gets unlocked // The user journey states thresholds when a new feature gets unlocked
public static userJourney = { public static userJourney = {

View file

@ -250,7 +250,7 @@
{ {
"#": "Access", "#": "Access",
"question": { "question": {
"en": "Who can use this bicycle?", "en": "Who can use this bicycle parking?",
"nl": "Wie mag er deze fietsenstalling gebruiken?" "nl": "Wie mag er deze fietsenstalling gebruiken?"
}, },
"render": { "render": {

View file

@ -107,5 +107,7 @@ if (layoutFromBase64.startsWith("wiki:")) {
} else { } else {
InitUiElements.InitAll(layoutToUse, layoutFromBase64, testing, defaultLayout); InitUiElements.InitAll(layoutToUse, layoutFromBase64, testing, defaultLayout);
} }
window.addEventListener('contextmenu', function (e) { // Not compatible with IE < 9
e.preventDefault();
}, false);
// console.log(QueryParameters.GenerateQueryParameterDocs()) // console.log(QueryParameters.GenerateQueryParameterDocs())