From 7ff1e7e3489edc14049f11e36e273ea45e85d8c5 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 14 Dec 2020 00:04:53 +0100 Subject: [PATCH] Add long press behaviour on the geolocate-me button --- Logic/Leaflet/GeoLocationHandler.ts | 13 ++++++++++--- State.ts | 2 +- assets/layers/bike_parking/bike_parking.json | 2 +- index.ts | 4 +++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Logic/Leaflet/GeoLocationHandler.ts b/Logic/Leaflet/GeoLocationHandler.ts index e83c3b5..e8a96af 100644 --- a/Logic/Leaflet/GeoLocationHandler.ts +++ b/Logic/Leaflet/GeoLocationHandler.ts @@ -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; + } + } } \ No newline at end of file diff --git a/State.ts b/State.ts index 2662d40..943974d 100644 --- a/State.ts +++ b/State.ts @@ -24,7 +24,7 @@ export default class State { // The singleton of the global 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 public static userJourney = { diff --git a/assets/layers/bike_parking/bike_parking.json b/assets/layers/bike_parking/bike_parking.json index 84f0e70..02fc72d 100644 --- a/assets/layers/bike_parking/bike_parking.json +++ b/assets/layers/bike_parking/bike_parking.json @@ -250,7 +250,7 @@ { "#": "Access", "question": { - "en": "Who can use this bicycle?", + "en": "Who can use this bicycle parking?", "nl": "Wie mag er deze fietsenstalling gebruiken?" }, "render": { diff --git a/index.ts b/index.ts index d117565..efb9dbd 100644 --- a/index.ts +++ b/index.ts @@ -107,5 +107,7 @@ if (layoutFromBase64.startsWith("wiki:")) { } else { InitUiElements.InitAll(layoutToUse, layoutFromBase64, testing, defaultLayout); } - +window.addEventListener('contextmenu', function (e) { // Not compatible with IE < 9 + e.preventDefault(); +}, false); // console.log(QueryParameters.GenerateQueryParameterDocs())