Merge pull request #1321 from umap-project/1318-restrict-zoom-options

Restrict possible min/max zoom values
This commit is contained in:
David Larlet 2023-09-22 12:12:56 -04:00 committed by GitHub
commit 2563357c02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 12 deletions

14
package-lock.json generated
View file

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

View file

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

View file

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

View file

@ -14,6 +14,7 @@ L.Map.mergeOptions({
default_popupContentTemplate: '# {name}\n{description}',
default_interactive: true,
default_labelDirection: 'auto',
maxZoomLimit: 20,
attributionControl: false,
editMode: 'advanced',
embedControl: true,
@ -1502,15 +1503,26 @@ L.U.Map.include({
handler: 'BlurInput',
helpText: `${L._('Supported scheme')}: http://{s}.domain.com/{z}/{x}/{y}.png`,
placeholder: 'url',
type: 'url',
},
],
[
'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',
@ -1541,15 +1553,26 @@ 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',
},
],
[
'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',