From 965faca0e51cbcc4a6928529d4d58146fc2a1815 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 8 Jan 2022 20:02:07 +0100 Subject: [PATCH] MapComplete now always zooms up to level 21 with overzoom, fix #606 --- Logic/Actors/AvailableBaseLayersImplementation.ts | 10 ++++++---- Logic/State/UserRelatedState.ts | 2 +- UI/Base/MinimapImplementation.ts | 10 +++++----- assets/layers/bench/bench.json | 2 +- langs/en.json | 2 +- langs/themes/en.json | 5 ++++- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Logic/Actors/AvailableBaseLayersImplementation.ts b/Logic/Actors/AvailableBaseLayersImplementation.ts index 13bc06898d..39dcdc4b17 100644 --- a/Logic/Actors/AvailableBaseLayersImplementation.ts +++ b/Logic/Actors/AvailableBaseLayersImplementation.ts @@ -156,11 +156,12 @@ export default class AvailableBaseLayersImplementation implements AvailableBaseL const isUpper = urlObj.searchParams["LAYERS"] !== null; const options = { - maxZoom: maxZoom ?? 19, + maxZoom: Math.max(maxZoom ?? 19, 21), + maxNativeZoom: maxZoom ?? 19, attribution: attribution + " | ", subdomains: domains, uppercase: isUpper, - transparent: false + transparent: false, }; for (const paramater of paramaters) { @@ -186,8 +187,9 @@ export default class AvailableBaseLayersImplementation implements AvailableBaseL return L.tileLayer(url, { attribution: attribution, - maxZoom: maxZoom, - minZoom: 1, + maxZoom: Math.max(21, maxZoom ?? 19), + maxNativeZoom: maxZoom ?? 19, + minZoom: 1, // @ts-ignore wmts: isWMTS ?? false, subdomains: domains diff --git a/Logic/State/UserRelatedState.ts b/Logic/State/UserRelatedState.ts index 37deb04dc2..e7d5a011b8 100644 --- a/Logic/State/UserRelatedState.ts +++ b/Logic/State/UserRelatedState.ts @@ -93,7 +93,7 @@ export default class UserRelatedState extends ElementsState { return } - if(this.layoutToUse.id.startsWith("http")){ + if(this.layoutToUse?.id?.startsWith("http")){ if(!this.installedThemes.data.some(installed => installed.id === this.layoutToUse.id)){ this.installedThemes.data.push({ diff --git a/UI/Base/MinimapImplementation.ts b/UI/Base/MinimapImplementation.ts index e5aa7f8eff..e729e61500 100644 --- a/UI/Base/MinimapImplementation.ts +++ b/UI/Base/MinimapImplementation.ts @@ -23,9 +23,9 @@ export default class MinimapImplementation extends BaseUIElement implements Mini private readonly _leafletoptions: any; private readonly _onFullyLoaded: (leaflet: L.Map) => void private readonly _attribution: BaseUIElement | boolean; - private readonly _lastClickLocation: UIEventSource<{ lat: number; lon: number }>; private readonly _bounds: UIEventSource | undefined; private readonly _addLayerControl: boolean; + private readonly _options : MinimapOptions; private constructor(options: MinimapOptions) { super() @@ -39,8 +39,8 @@ export default class MinimapImplementation extends BaseUIElement implements Mini this._leafletoptions = options.leafletOptions ?? {} this._onFullyLoaded = options.onFullyLoaded this._attribution = options.attribution - this._lastClickLocation = options.lastClickLocation; this._addLayerControl = options.addLayerControl ?? false + this._options = options MinimapImplementation._nextId++ } @@ -200,6 +200,7 @@ export default class MinimapImplementation extends BaseUIElement implements Mini touchZoom: this._allowMoving, // Disabling this breaks the geojson layer - don't ask me why! zoomAnimation: this._allowMoving, fadeAnimation: this._allowMoving, + maxZoom: 21 } Utils.Merge(this._leafletoptions, options) @@ -244,7 +245,6 @@ export default class MinimapImplementation extends BaseUIElement implements Mini }) } map.addLayer(newLayer); - map.setMaxZoom(layer.max_zoom ?? map.getMaxZoom()) if (self._attribution !== true && self._attribution !== false) { self._attribution?.AttachTo('leaflet-attribution') } @@ -300,8 +300,8 @@ export default class MinimapImplementation extends BaseUIElement implements Mini } - if (this._lastClickLocation) { - const lastClickLocation = this._lastClickLocation + if (this._options.lastClickLocation) { + const lastClickLocation = this._options.lastClickLocation map.on("click", function (e) { // @ts-ignore lastClickLocation?.setData({lat: e.latlng.lat, lon: e.latlng.lng}) diff --git a/assets/layers/bench/bench.json b/assets/layers/bench/bench.json index 2f5e9dc3b6..d5aa72b689 100644 --- a/assets/layers/bench/bench.json +++ b/assets/layers/bench/bench.json @@ -633,7 +633,7 @@ "mapRendering": [ { "icon": { - "render": "circle:#FE6F32;./assets/layers/bench/bench.svg" + "render": "./assets/layers/bench/bench.svg" }, "iconSize": { "render": "35,35,center" diff --git a/langs/en.json b/langs/en.json index a5bc88b95c..6fc3c3ced5 100644 --- a/langs/en.json +++ b/langs/en.json @@ -436,6 +436,6 @@ "anonymous": "Anonymous user", "loginToAddComment": "Login to add a comment", "loginToAddPicture": "Login to add a picture", - "loginToClose": "Login to close this note", + "loginToClose": "Login to close this note" } } diff --git a/langs/themes/en.json b/langs/themes/en.json index 4c15561123..1364ca3253 100644 --- a/langs/themes/en.json +++ b/langs/themes/en.json @@ -986,8 +986,11 @@ }, "name": "OpenStreetMap notes", "tagRenderings": { - "Spam": { + "report-contributor": { "render": "Report {_first_user} as spam" + }, + "report-note": { + "render": "Report this note as spam or inappropriate" } }, "title": {