@nextgis/ngw-leaflet 1.18.12 → 1.18.21

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.18.12; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.18.21; author: NextGIS */
2
2
  function styleInject(css, ref) {
3
3
  if ( ref === void 0 ) ref = {};
4
4
  var insertAt = ref.insertAt;
@@ -15165,20 +15165,6 @@ function getIdentifyRadius(center, zoom, pixelRadius) {
15165
15165
  return radius;
15166
15166
  }
15167
15167
 
15168
- /**
15169
- * Copy the values of all of the enumerable own properties from one or more source objects to a
15170
- * target object. Returns the target object.
15171
- * @param target - The target object to copy to.
15172
- * @param sources - One or more source objects from which to copy properties
15173
- */
15174
- function objectAssign(target, ...sources) {
15175
- for (const source of sources) {
15176
- for (const prop of Object.getOwnPropertyNames(source)) {
15177
- target[prop] = source[prop];
15178
- }
15179
- }
15180
- }
15181
-
15182
15168
  function isEqual(a, b, o, p) {
15183
15169
  if (a instanceof Array) {
15184
15170
  if (!(b instanceof Array))
@@ -20748,48 +20734,12 @@ class NgwWebmapItem extends Item {
20748
20734
  return ngwWebmapItem;
20749
20735
  }
20750
20736
  initItem(item) {
20751
- const i = item;
20752
- const options = this.getItemOptions(item);
20753
- const setNewLayer = (l) => {
20754
- i._layer = l;
20755
- this.layer = l;
20756
- const enabled = this.properties.get('visibility');
20757
- if (enabled) {
20758
- this.properties.set('visibility', true);
20759
- }
20760
- if (options.opacity !== undefined) {
20761
- this.webMap.setLayerOpacity(l, options.opacity);
20762
- }
20763
- };
20764
20737
  if (item.item_type === 'group' || item.item_type === 'root') {
20765
- if (item.children && item.children.length) {
20766
- const children = this.getChildren(item);
20767
- for (const x of children) {
20768
- const children = new this.constructor(this.webMap, x, this.options, this.connector, this);
20769
- this.tree.addChild(children);
20770
- }
20771
- }
20772
- return Promise.resolve();
20738
+ return this.initGroupItem(item);
20773
20739
  }
20774
20740
  else {
20775
- let adapter;
20776
- if (item.item_type === 'layer') {
20777
- adapter = item.adapter || item.layer_adapter.toUpperCase();
20778
- }
20779
- else if (NgwWebmapItem.GetAdapterFromLayerType[item.item_type]) {
20780
- const getAdapter = NgwWebmapItem.GetAdapterFromLayerType[item.item_type];
20781
- adapter = getAdapter(item, options, this.webMap, this.connector);
20782
- }
20783
- if (adapter) {
20784
- return this.webMap.addLayer(adapter, options).then((newLayer) => {
20785
- setNewLayer(newLayer);
20786
- });
20787
- }
20788
- }
20789
- if (item._layer) {
20790
- return Promise.resolve(setNewLayer(item._layer));
20741
+ return this.initLayerItem(item);
20791
20742
  }
20792
- return Promise.reject('No layer added');
20793
20743
  }
20794
20744
  bringToFront() {
20795
20745
  //
@@ -20824,7 +20774,7 @@ class NgwWebmapItem extends Item {
20824
20774
  }
20825
20775
  if (item.item_type === 'layer') {
20826
20776
  const { maxZoom, minZoom } = this._getZoomRange(item);
20827
- objectAssign(options, {
20777
+ Object.assign(options, {
20828
20778
  updateWmsParams: item.updateWmsParams,
20829
20779
  url: item.url,
20830
20780
  headers: this.options.headers,
@@ -20833,6 +20783,7 @@ class NgwWebmapItem extends Item {
20833
20783
  minZoom,
20834
20784
  minScale: item.layer_min_scale_denom,
20835
20785
  maxScale: item.layer_max_scale_denom,
20786
+ interactive: item.layer_identifiable,
20836
20787
  });
20837
20788
  }
20838
20789
  if (opacity !== undefined) {
@@ -20846,6 +20797,47 @@ class NgwWebmapItem extends Item {
20846
20797
  _mapScaleToZoomLevel(scale) {
20847
20798
  return setScaleRatio(scale);
20848
20799
  }
20800
+ initGroupItem(group) {
20801
+ if (group.children && group.children.length) {
20802
+ const children = this.getChildren(group);
20803
+ for (const child of children) {
20804
+ const childItem = new this.constructor(this.webMap, child, this.options, this.connector, this);
20805
+ this.tree.addChild(childItem);
20806
+ }
20807
+ }
20808
+ return Promise.resolve();
20809
+ }
20810
+ initLayerItem(layer) {
20811
+ const options = this.getItemOptions(layer);
20812
+ const setNewLayer = (l) => {
20813
+ layer._layer = l;
20814
+ this.layer = l;
20815
+ const enabled = this.properties.get('visibility');
20816
+ if (enabled) {
20817
+ this.properties.set('visibility', true);
20818
+ }
20819
+ if (options.opacity !== undefined) {
20820
+ this.webMap.setLayerOpacity(l, options.opacity);
20821
+ }
20822
+ };
20823
+ let adapter;
20824
+ if (layer.item_type === 'layer') {
20825
+ adapter = layer.adapter || layer.layer_adapter.toUpperCase();
20826
+ }
20827
+ else if (NgwWebmapItem.GetAdapterFromLayerType[layer.item_type]) {
20828
+ const getAdapter = NgwWebmapItem.GetAdapterFromLayerType[layer.item_type];
20829
+ adapter = getAdapter(layer, options, this.webMap, this.connector);
20830
+ }
20831
+ if (adapter) {
20832
+ return this.webMap.addLayer(adapter, options).then((newLayer) => {
20833
+ setNewLayer(newLayer);
20834
+ });
20835
+ }
20836
+ if (layer._layer) {
20837
+ return Promise.resolve(setNewLayer(layer._layer));
20838
+ }
20839
+ return Promise.reject('No layer added');
20840
+ }
20849
20841
  _getZoomRange(item) {
20850
20842
  const minZoomWebmap = this.options.minZoom;
20851
20843
  const maxZoomWebmap = this.options.maxZoom;
@@ -21203,7 +21195,9 @@ class NgwWebmapLayerAdapter {
21203
21195
  deps.forEach((x) => {
21204
21196
  const item = x.item;
21205
21197
  const parentId = item.parentId;
21206
- if (parentId !== undefined && item.item_type === 'layer') {
21198
+ if (parentId !== undefined &&
21199
+ item.item_type === 'layer' &&
21200
+ item.layer_identifiable) {
21207
21201
  const visible = x.properties.property('visibility');
21208
21202
  const isVisible = visible.get() && !visible.isBlocked();
21209
21203
  if (isVisible) {
@@ -22614,6 +22608,7 @@ class NgwMap extends WebMap {
22614
22608
  });
22615
22609
  }
22616
22610
  async selectFromNgwRaster(ev) {
22611
+ var _a;
22617
22612
  this._emitStatusEvent('ngw:preselect');
22618
22613
  const promises = [];
22619
22614
  const layers = Object.values(this._ngwLayers);
@@ -22628,7 +22623,11 @@ class NgwMap extends WebMap {
22628
22623
  const identFunc = typeof layer.getIdentificationIds === 'function'
22629
22624
  ? layer.getIdentificationIds
22630
22625
  : false;
22631
- if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
22626
+ const interactive = (_a = layer.options.interactive) !== null && _a !== void 0 ? _a : true;
22627
+ if (identFunc &&
22628
+ layer.options.selectable &&
22629
+ interactive &&
22630
+ this.isLayerVisible(layer)) {
22632
22631
  promises.push(identFunc.call(layer));
22633
22632
  }
22634
22633
  }