MapComplete now always zooms up to level 21 with overzoom, fix #606

This commit is contained in:
Pieter Vander Vennet 2022-01-08 20:02:07 +01:00
parent 7a43b55245
commit 965faca0e5
6 changed files with 18 additions and 13 deletions

View file

@ -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

View file

@ -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({

View file

@ -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<BBox> | 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})

View file

@ -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"

View file

@ -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"
}
}

View file

@ -986,8 +986,11 @@
},
"name": "OpenStreetMap notes",
"tagRenderings": {
"Spam": {
"report-contributor": {
"render": "<a href='https://www.openstreetmap.org/reports/new?reportable_id={_first_user_id}&reportable_type=User' target='_blank' class='subtle'>Report {_first_user} as spam</a>"
},
"report-note": {
"render": "<a href='https://www.openstreetmap.org/reports/new?reportable_id={id}&reportable_type=Note' target='_blank'>Report this note as spam or inappropriate</a>"
}
},
"title": {