From aed9e898e9ed7719cd821f21ec3ce9ffd68855f6 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Tue, 19 Sep 2023 13:56:11 -0400 Subject: [PATCH 1/2] Restrict possible min/max zoom values Fix #1318 --- umap/static/umap/base.css | 5 +++++ umap/static/umap/js/umap.js | 29 +++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/umap/static/umap/base.css b/umap/static/umap/base.css index 05af31bf..5bc48647 100644 --- a/umap/static/umap/base.css +++ b/umap/static/umap/base.css @@ -669,6 +669,11 @@ input[type=hidden].blur + .button { /*box-shadow: inset 0 0 0 1px #215d9c;*/ color: #efefef; } +input:invalid { + border-color: red; + background-color: darkred; +} + /* *********** */ /* Alerts */ diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 27414e33..8537819e 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -14,6 +14,7 @@ L.Map.mergeOptions({ default_popupContentTemplate: '# {name}\n{description}', default_interactive: true, default_labelDirection: 'auto', + maxZoomLimit: 20, attributionControl: false, allowEdit: true, embedControl: true, @@ -1524,11 +1525,21 @@ L.U.Map.include({ ], [ 'options.tilelayer.maxZoom', - { handler: 'BlurIntInput', placeholder: L._('max zoom') }, + { + handler: 'BlurIntInput', + placeholder: L._('max zoom'), + min: 0, + max: this.options.maxZoomLimit, + }, ], [ 'options.tilelayer.minZoom', - { handler: 'BlurIntInput', placeholder: L._('min zoom') }, + { + handler: 'BlurIntInput', + placeholder: L._('min zoom'), + min: 0, + max: this.options.maxZoomLimit, + }, ], [ 'options.tilelayer.attribution', @@ -1563,11 +1574,21 @@ L.U.Map.include({ ], [ 'options.overlay.maxZoom', - { handler: 'BlurIntInput', placeholder: L._('max zoom') }, + { + handler: 'BlurIntInput', + placeholder: L._('max zoom'), + min: 0, + max: this.options.maxZoomLimit, + }, ], [ 'options.overlay.minZoom', - { handler: 'BlurIntInput', placeholder: L._('min zoom') }, + { + handler: 'BlurIntInput', + placeholder: L._('min zoom'), + min: 0, + max: this.options.maxZoomLimit, + }, ], [ 'options.overlay.attribution', From f6dbb7d45b01b3bae217a84c4570c34bf57a6072 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Fri, 22 Sep 2023 12:08:22 -0400 Subject: [PATCH 2/2] Correct `url` type for background url templates --- package-lock.json | 14 +++++++------- package.json | 2 +- umap/static/umap/js/umap.js | 2 ++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 930c16ca..f6c5ca40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "leaflet-contextmenu": "^1.4.0", "leaflet-editable": "^1.2.0", "leaflet-editinosm": "0.2.3", - "leaflet-formbuilder": "0.2.6", + "leaflet-formbuilder": "0.2.7", "leaflet-fullscreen": "1.0.2", "leaflet-hash": "0.2.1", "leaflet-i18n": "0.3.3", @@ -1377,9 +1377,9 @@ "integrity": "sha1-8HFmTEpSe3b3uPm87HRLJIiVwHE=" }, "node_modules/leaflet-formbuilder": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/leaflet-formbuilder/-/leaflet-formbuilder-0.2.6.tgz", - "integrity": "sha512-aBpR0PqvsFYVjPSwhPyOQGymQAmepOrZSXniwYimRSJMX7IO4TNeNv1Svwn7yiuKms7T0Y/Ib7KWnGy1c+A91Q==" + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/leaflet-formbuilder/-/leaflet-formbuilder-0.2.7.tgz", + "integrity": "sha512-5/QXEPmlSPNzl5r8rNlhcQOfI2Bx9vo/FBaBCV7o37MmZZ2jyA4aRu+6j91CnyRmKXfU5f/42E0yJva/Dwnqcw==" }, "node_modules/leaflet-fullscreen": { "version": "1.0.2", @@ -3564,9 +3564,9 @@ "integrity": "sha1-8HFmTEpSe3b3uPm87HRLJIiVwHE=" }, "leaflet-formbuilder": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/leaflet-formbuilder/-/leaflet-formbuilder-0.2.6.tgz", - "integrity": "sha512-aBpR0PqvsFYVjPSwhPyOQGymQAmepOrZSXniwYimRSJMX7IO4TNeNv1Svwn7yiuKms7T0Y/Ib7KWnGy1c+A91Q==" + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/leaflet-formbuilder/-/leaflet-formbuilder-0.2.7.tgz", + "integrity": "sha512-5/QXEPmlSPNzl5r8rNlhcQOfI2Bx9vo/FBaBCV7o37MmZZ2jyA4aRu+6j91CnyRmKXfU5f/42E0yJva/Dwnqcw==" }, "leaflet-fullscreen": { "version": "1.0.2", diff --git a/package.json b/package.json index e6dcd033..b2995e06 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "leaflet-contextmenu": "^1.4.0", "leaflet-editable": "^1.2.0", "leaflet-editinosm": "0.2.3", - "leaflet-formbuilder": "0.2.6", + "leaflet-formbuilder": "0.2.7", "leaflet-fullscreen": "1.0.2", "leaflet-hash": "0.2.1", "leaflet-i18n": "0.3.3", diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 8537819e..a10eb7a9 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -1521,6 +1521,7 @@ L.U.Map.include({ handler: 'BlurInput', helpText: `${L._('Supported scheme')}: http://{s}.domain.com/{z}/{x}/{y}.png`, placeholder: 'url', + type: 'url', }, ], [ @@ -1570,6 +1571,7 @@ L.U.Map.include({ helpText: `${L._('Supported scheme')}: http://{s}.domain.com/{z}/{x}/{y}.png`, placeholder: 'url', helpText: L._('Background overlay url'), + type: 'url', }, ], [