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.
package/mbt.js CHANGED
@@ -46302,15 +46302,29 @@ uniform ${i3} ${a3} u_${s3};
46302
46302
  for (let i = 0; i < layers.length; i += 1) {
46303
46303
  const layer = layers[i];
46304
46304
  if (this.layersFilter(layer)) {
46305
- const { id } = layer;
46305
+ const { id, maxzoom, minzoom } = layer;
46306
46306
  if (mapLibreMap.getLayer(id)) {
46307
46307
  mapLibreMap.setLayoutProperty(id, "visibility", visibilityValue);
46308
- if (this.getMinZoom() || this.getMaxZoom()) {
46308
+ if (this.getMinZoom() !== -Infinity || this.getMaxZoom() !== Infinity) {
46309
+ let minZoom = this.getMinZoom() || 0;
46310
+ if (minZoom === -Infinity) {
46311
+ minZoom = (minzoom || 0) + 1;
46312
+ }
46313
+ if (minZoom === 0) {
46314
+ minZoom = 1;
46315
+ }
46316
+ let maxZoom = this.getMaxZoom() || 0;
46317
+ if (maxZoom === Infinity) {
46318
+ maxZoom = (maxzoom || 24) + 1;
46319
+ }
46320
+ if (maxZoom === 0) {
46321
+ maxZoom = 1;
46322
+ }
46309
46323
  mapLibreMap.setLayerZoomRange(
46310
46324
  id,
46311
- this.getMinZoom() ? this.getMinZoom() - 1 : 0,
46325
+ minZoom - 1,
46312
46326
  // Maplibre zoom = ol zoom - 1
46313
- this.getMaxZoom() ? this.getMaxZoom() - 1 : 24
46327
+ maxZoom - 1
46314
46328
  );
46315
46329
  }
46316
46330
  }