@nextgis/ngw-map 1.13.8 → 1.14.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.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 1.13.8; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.14.0; author: NextGIS */
2
2
  var NgwMap = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1864,7 +1864,7 @@ var NgwMap = (function (exports) {
1864
1864
  var ID$2 = 0;
1865
1865
  var OPTIONS$1 = {
1866
1866
  minZoom: 0,
1867
- maxZoom: 20,
1867
+ maxZoom: 22,
1868
1868
  paint: {
1869
1869
  color: '#0000ff',
1870
1870
  opacity: 0.4,
@@ -5898,7 +5898,7 @@ var NgwMap = (function (exports) {
5898
5898
  'resource=' +
5899
5899
  resourceId +
5900
5900
  '&simplification=' +
5901
- ((_b = options.simplification) !== null && _b !== void 0 ? _b : 8);
5901
+ ((_b = options.simplification) !== null && _b !== void 0 ? _b : 6);
5902
5902
  // url = baseUrl + '/api/resource/' + options.resourceId + '/{z}/{x}/{y}.mvt';
5903
5903
  return {
5904
5904
  url: url,
@@ -5977,29 +5977,13 @@ var NgwMap = (function (exports) {
5977
5977
  baseUrl: connector.options.baseUrl || '',
5978
5978
  });
5979
5979
  if (opt) {
5980
- var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 },
5981
- // @deprecated
5982
- layers: String(resourceId_1), resourceId: resourceId_1 });
5980
+ var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 }, layers: opt.layers || String(resourceId_1), resourceId: resourceId_1 });
5983
5981
  if (layerOptions.adapterOptions &&
5984
5982
  defined(layerOptions.adapterOptions.setViewDelay)) {
5985
5983
  layerAdapterOptions.setViewDelay =
5986
5984
  layerOptions.adapterOptions.setViewDelay;
5987
5985
  }
5988
5986
  _this.options = __assign(__assign({}, _this.options), layerAdapterOptions);
5989
- // if (true) {
5990
- // Object.defineProperty(this.options, 'layers', {
5991
- // get: () => {
5992
- // console.warn('Do not use `layers` in ImageAdapterOptions');
5993
- // return String(resourceId);
5994
- // },
5995
- // });
5996
- // Object.defineProperty(this.options, 'resourceId', {
5997
- // get: () => {
5998
- // console.warn('Do not use `resourceId` in ImageAdapterOptions');
5999
- // return resourceId;
6000
- // },
6001
- // });
6002
- // }
6003
5987
  }
6004
5988
  return _this;
6005
5989
  }
@@ -8670,13 +8654,14 @@ var NgwMap = (function (exports) {
8670
8654
  var _this = this;
8671
8655
  if (!this.$$selectFromNgwRaster) {
8672
8656
  this.$$selectFromNgwRaster = function (ev) {
8673
- var count = _this.emitter.listenerCount('ngw:select');
8657
+ var count = _this._getSelectListenersCount();
8674
8658
  if (count) {
8675
8659
  _this._selectFromNgwRaster(ev);
8676
8660
  }
8677
8661
  };
8678
8662
  this.$$selectFromNgwVector = function (ev) {
8679
- if (_this.emitter.listenerCount('ngw:select')) {
8663
+ var count = _this._getSelectListenersCount();
8664
+ if (count) {
8680
8665
  _this._selectFromNgwVector(ev);
8681
8666
  }
8682
8667
  };
@@ -8687,8 +8672,10 @@ var NgwMap = (function (exports) {
8687
8672
  NgwMap.prototype.disableSelection = function () {
8688
8673
  if (this.$$selectFromNgwRaster) {
8689
8674
  this.emitter.removeListener('click', this.$$selectFromNgwRaster);
8690
- this.emitter.removeListener('click', this._selectFromNgwVector);
8691
8675
  this.$$selectFromNgwRaster = undefined;
8676
+ }
8677
+ if (this.$$selectFromNgwVector) {
8678
+ this.emitter.removeListener('layer:click', this.$$selectFromNgwVector);
8692
8679
  this.$$selectFromNgwVector = undefined;
8693
8680
  }
8694
8681
  };
@@ -8844,7 +8831,11 @@ var NgwMap = (function (exports) {
8844
8831
  NgwMap.prototype._selectFromNgwVector = function (ev) {
8845
8832
  var _a;
8846
8833
  var layer = ev.layer;
8847
- // item property means layer is NgwResource
8834
+ var selectable = layer.options.selectable && this.isLayerVisible(layer);
8835
+ if (!selectable) {
8836
+ return undefined;
8837
+ }
8838
+ // Item property means layer is NgwResource
8848
8839
  var id = layer.item && layer.item.resource.id;
8849
8840
  var feature = ev.feature;
8850
8841
  if (id !== undefined && feature) {
@@ -8874,10 +8865,10 @@ var NgwMap = (function (exports) {
8874
8865
  };
8875
8866
  NgwMap.prototype._selectFromNgwRaster = function (ev) {
8876
8867
  return __awaiter(this, void 0, void 0, function () {
8877
- var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, pixelRadius, center, zoom, radius, selectPromise;
8868
+ var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
8878
8869
  var _this = this;
8879
- return __generator(this, function (_a) {
8880
- switch (_a.label) {
8870
+ return __generator(this, function (_b) {
8871
+ switch (_b.label) {
8881
8872
  case 0:
8882
8873
  this._emitStatusEvent('ngw:preselect');
8883
8874
  promises = [];
@@ -8901,13 +8892,14 @@ var NgwMap = (function (exports) {
8901
8892
  getIdsPromise = Promise.all(promises);
8902
8893
  return [4 /*yield*/, getIdsPromise];
8903
8894
  case 1:
8904
- getIds = _a.sent();
8895
+ getIds = _b.sent();
8905
8896
  ids = [];
8906
- getIds.forEach(function (x) {
8897
+ for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
8898
+ x = getIds_1[_a];
8907
8899
  if (x) {
8908
- x.forEach(function (y) { return ids.push(y); });
8900
+ ids.push.apply(ids, x);
8909
8901
  }
8910
- });
8902
+ }
8911
8903
  if (!ids.length) {
8912
8904
  this._emitStatusEvent('ngw:select', null);
8913
8905
  return [2 /*return*/];
@@ -8947,6 +8939,9 @@ var NgwMap = (function (exports) {
8947
8939
  };
8948
8940
  return __assign(__assign({}, identify), { getIdentifyItems: getIdentifyItems_ });
8949
8941
  };
8942
+ NgwMap.prototype._getSelectListenersCount = function () {
8943
+ return this.emitter.listenerCount('ngw:select');
8944
+ };
8950
8945
  NgwMap.prototype._whiteLabel = function () {
8951
8946
  return __awaiter(this, void 0, void 0, function () {
8952
8947
  var container, logo;