mobility-toolbox-js 3.1.0 → 3.1.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -209,12 +209,28 @@ class MaplibreStyleLayer extends Layer {
209
209
  for (let i = 0; i < layers.length; i += 1) {
210
210
  const layer = layers[i];
211
211
  if (this.layersFilter(layer)) {
212
- const { id } = layer;
212
+ const { id, maxzoom, minzoom } = layer;
213
213
  if (mapLibreMap.getLayer(id)) {
214
214
  mapLibreMap.setLayoutProperty(id, 'visibility', visibilityValue);
215
- if (this.getMinZoom() || this.getMaxZoom()) {
216
- mapLibreMap.setLayerZoomRange(id, this.getMinZoom() ? this.getMinZoom() - 1 : 0, // Maplibre zoom = ol zoom - 1
217
- this.getMaxZoom() ? this.getMaxZoom() - 1 : 24);
215
+ // If minZoom and maxZoom are not set, their values are -Infinity and Infinity
216
+ if (this.getMinZoom() !== -Infinity ||
217
+ this.getMaxZoom() !== Infinity) {
218
+ let minZoom = this.getMinZoom() || 0;
219
+ if (minZoom === -Infinity) {
220
+ minZoom = (minzoom || 0) + 1;
221
+ }
222
+ if (minZoom === 0) {
223
+ minZoom = 1;
224
+ }
225
+ let maxZoom = this.getMaxZoom() || 0;
226
+ if (maxZoom === Infinity) {
227
+ maxZoom = (maxzoom || 24) + 1;
228
+ }
229
+ if (maxZoom === 0) {
230
+ maxZoom = 1;
231
+ }
232
+ mapLibreMap.setLayerZoomRange(id, minZoom - 1, // Maplibre zoom = ol zoom - 1
233
+ maxZoom - 1);
218
234
  }
219
235
  }
220
236
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mobility-toolbox-js",
3
3
  "license": "MIT",
4
4
  "description": "Toolbox for JavaScript applications in the domains of mobility and logistics.",
5
- "version": "3.1.0",
5
+ "version": "3.1.1-beta.0",
6
6
  "homepage": "https://mobility-toolbox-js.geops.io/",
7
7
  "exports": {
8
8
  ".": "./index.js",