@nextgis/ngw-leaflet 1.8.3 → 1.8.4

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.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.8.3; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.8.4; author: NextGIS */
2
2
  function styleInject(css, ref) {
3
3
  if ( ref === void 0 ) ref = {};
4
4
  var insertAt = ref.insertAt;
@@ -19739,12 +19739,7 @@ class NgwWebmapItem extends Item {
19739
19739
  options.order = Number((this.options.order | 0) + '.' + subLevel);
19740
19740
  }
19741
19741
  if (item.item_type === 'layer') {
19742
- const maxZoom = item.layer_max_scale_denom
19743
- ? this._mapScaleToZoomLevel(item.layer_max_scale_denom)
19744
- : this.webMap.options.maxZoom;
19745
- const minZoom = item.layer_min_scale_denom
19746
- ? this._mapScaleToZoomLevel(item.layer_min_scale_denom)
19747
- : this.webMap.options.minZoom;
19742
+ const { maxZoom, minZoom } = this._getZoomRange(item);
19748
19743
  objectAssign(options, {
19749
19744
  updateWmsParams: item.updateWmsParams,
19750
19745
  url: item.url,
@@ -19767,6 +19762,23 @@ class NgwWebmapItem extends Item {
19767
19762
  _mapScaleToZoomLevel(scale) {
19768
19763
  return setScaleRatio(scale);
19769
19764
  }
19765
+ _getZoomRange(item) {
19766
+ const minZoomMap = this.webMap.options.minZoom;
19767
+ const maxZoomMap = this.webMap.options.maxZoom;
19768
+ const minZoomWebmap = this.options.minZoom;
19769
+ const maxZoomWebmap = this.options.maxZoom;
19770
+ const minZoomLayer = item.layer_min_scale_denom
19771
+ ? this._mapScaleToZoomLevel(item.layer_min_scale_denom)
19772
+ : undefined;
19773
+ const maxZoomLayer = item.layer_max_scale_denom
19774
+ ? this._mapScaleToZoomLevel(item.layer_max_scale_denom)
19775
+ : undefined;
19776
+ const minZooms = [minZoomMap, minZoomWebmap, minZoomLayer].filter(Boolean);
19777
+ const maxZooms = [maxZoomMap, maxZoomWebmap, maxZoomLayer].filter(Boolean);
19778
+ const minZoom = Math.max(...minZooms);
19779
+ const maxZoom = Math.min(...maxZooms);
19780
+ return { minZoom, maxZoom };
19781
+ }
19770
19782
  _init(item) {
19771
19783
  this.initItem(item).then(() => {
19772
19784
  this.emitter.emit('init');
@@ -20116,6 +20128,8 @@ class NgwWebmapLayerAdapter {
20116
20128
  options.order = this.options.order;
20117
20129
  options.ratio = this.options.ratio;
20118
20130
  options.crossOrigin = this.options.crossOrigin;
20131
+ options.minZoom = this.options.minZoom;
20132
+ options.maxZoom = this.options.maxZoom;
20119
20133
  options.drawOrderEnabled = webmap.draw_order_enabled;
20120
20134
  const layer = new this.NgwWebmapItem(this.options.webMap, webmap.root_item, options, this.options.connector);
20121
20135
  layer.emitter.on('init', () => resolve(layer));