From 219895191d1ef3742961804a27f439a9d396dcc9 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sun, 18 Jul 2021 21:48:11 +0200 Subject: [PATCH] Disable adding new elements-popup if the userbadge is disabled; add small cosmetic changes --- Logic/Actors/StrayClickHandler.ts | 7 ++++++- State.ts | 6 ++++++ UI/ShowDataLayer.ts | 4 +++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Logic/Actors/StrayClickHandler.ts b/Logic/Actors/StrayClickHandler.ts index b4d630070..3e7609fd4 100644 --- a/Logic/Actors/StrayClickHandler.ts +++ b/Logic/Actors/StrayClickHandler.ts @@ -47,7 +47,12 @@ export default class StrayClickHandler { popupAnchor: [0, -45] }) }); - const popup = L.popup().setContent("
"); + const popup = L.popup({ + autoPan: true, + autoPanPaddingTopLeft: [15,15], + closeOnEscapeKey: true, + autoClose: true + }).setContent("
"); self._lastMarker.addTo(leafletMap.data); self._lastMarker.bindPopup(popup); diff --git a/State.ts b/State.ts index a5bad6706..418657266 100644 --- a/State.ts +++ b/State.ts @@ -193,6 +193,12 @@ export default class State { "Disables/Enables the layer control"); this.featureSwitchAddNew = featSw("fs-add-new", (layoutToUse) => layoutToUse?.enableAddNewPoints ?? true, "Disables/Enables the 'add new feature'-popup. (A theme without presets might not have it in the first place)"); + this.featureSwitchUserbadge.addCallbackAndRun(userbadge => { + if (!userbadge) { + this.featureSwitchAddNew.setData(false) + } + }) + this.featureSwitchWelcomeMessage = featSw("fs-welcome-message", () => true, "Disables/enables the help menu or welcome message"); this.featureSwitchIframe = featSw("fs-iframe", () => false, diff --git a/UI/ShowDataLayer.ts b/UI/ShowDataLayer.ts index df45af45e..59225640f 100644 --- a/UI/ShowDataLayer.ts +++ b/UI/ShowDataLayer.ts @@ -146,7 +146,9 @@ export default class ShowDataLayer { const popup = L.popup({ autoPan: true, closeOnEscapeKey: true, - closeButton: false + closeButton: false, + autoPanPaddingTopLeft: [15,15], + }, leafletLayer); leafletLayer.bindPopup(popup);