@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
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -1861,7 +1861,7 @@ function clearObject(obj) {
1861
1861
  var ID$2 = 0;
1862
1862
  var OPTIONS$1 = {
1863
1863
  minZoom: 0,
1864
- maxZoom: 20,
1864
+ maxZoom: 22,
1865
1865
  paint: {
1866
1866
  color: '#0000ff',
1867
1867
  opacity: 0.4,
@@ -5895,7 +5895,7 @@ function ngwApiToAdapterOptions(_a) {
5895
5895
  'resource=' +
5896
5896
  resourceId +
5897
5897
  '&simplification=' +
5898
- ((_b = options.simplification) !== null && _b !== void 0 ? _b : 8);
5898
+ ((_b = options.simplification) !== null && _b !== void 0 ? _b : 6);
5899
5899
  // url = baseUrl + '/api/resource/' + options.resourceId + '/{z}/{x}/{y}.mvt';
5900
5900
  return {
5901
5901
  url: url,
@@ -5974,29 +5974,13 @@ function createRasterAdapter(_a) {
5974
5974
  baseUrl: connector.options.baseUrl || '',
5975
5975
  });
5976
5976
  if (opt) {
5977
- var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 },
5978
- // @deprecated
5979
- layers: String(resourceId_1), resourceId: resourceId_1 });
5977
+ var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 }, layers: opt.layers || String(resourceId_1), resourceId: resourceId_1 });
5980
5978
  if (layerOptions.adapterOptions &&
5981
5979
  defined(layerOptions.adapterOptions.setViewDelay)) {
5982
5980
  layerAdapterOptions.setViewDelay =
5983
5981
  layerOptions.adapterOptions.setViewDelay;
5984
5982
  }
5985
5983
  _this.options = __assign(__assign({}, _this.options), layerAdapterOptions);
5986
- // if (true) {
5987
- // Object.defineProperty(this.options, 'layers', {
5988
- // get: () => {
5989
- // console.warn('Do not use `layers` in ImageAdapterOptions');
5990
- // return String(resourceId);
5991
- // },
5992
- // });
5993
- // Object.defineProperty(this.options, 'resourceId', {
5994
- // get: () => {
5995
- // console.warn('Do not use `resourceId` in ImageAdapterOptions');
5996
- // return resourceId;
5997
- // },
5998
- // });
5999
- // }
6000
5984
  }
6001
5985
  return _this;
6002
5986
  }
@@ -8667,13 +8651,14 @@ var NgwMap = /** @class */ (function (_super) {
8667
8651
  var _this = this;
8668
8652
  if (!this.$$selectFromNgwRaster) {
8669
8653
  this.$$selectFromNgwRaster = function (ev) {
8670
- var count = _this.emitter.listenerCount('ngw:select');
8654
+ var count = _this._getSelectListenersCount();
8671
8655
  if (count) {
8672
8656
  _this._selectFromNgwRaster(ev);
8673
8657
  }
8674
8658
  };
8675
8659
  this.$$selectFromNgwVector = function (ev) {
8676
- if (_this.emitter.listenerCount('ngw:select')) {
8660
+ var count = _this._getSelectListenersCount();
8661
+ if (count) {
8677
8662
  _this._selectFromNgwVector(ev);
8678
8663
  }
8679
8664
  };
@@ -8684,8 +8669,10 @@ var NgwMap = /** @class */ (function (_super) {
8684
8669
  NgwMap.prototype.disableSelection = function () {
8685
8670
  if (this.$$selectFromNgwRaster) {
8686
8671
  this.emitter.removeListener('click', this.$$selectFromNgwRaster);
8687
- this.emitter.removeListener('click', this._selectFromNgwVector);
8688
8672
  this.$$selectFromNgwRaster = undefined;
8673
+ }
8674
+ if (this.$$selectFromNgwVector) {
8675
+ this.emitter.removeListener('layer:click', this.$$selectFromNgwVector);
8689
8676
  this.$$selectFromNgwVector = undefined;
8690
8677
  }
8691
8678
  };
@@ -8841,7 +8828,11 @@ var NgwMap = /** @class */ (function (_super) {
8841
8828
  NgwMap.prototype._selectFromNgwVector = function (ev) {
8842
8829
  var _a;
8843
8830
  var layer = ev.layer;
8844
- // item property means layer is NgwResource
8831
+ var selectable = layer.options.selectable && this.isLayerVisible(layer);
8832
+ if (!selectable) {
8833
+ return undefined;
8834
+ }
8835
+ // Item property means layer is NgwResource
8845
8836
  var id = layer.item && layer.item.resource.id;
8846
8837
  var feature = ev.feature;
8847
8838
  if (id !== undefined && feature) {
@@ -8871,10 +8862,10 @@ var NgwMap = /** @class */ (function (_super) {
8871
8862
  };
8872
8863
  NgwMap.prototype._selectFromNgwRaster = function (ev) {
8873
8864
  return __awaiter(this, void 0, void 0, function () {
8874
- var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, pixelRadius, center, zoom, radius, selectPromise;
8865
+ var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
8875
8866
  var _this = this;
8876
- return __generator(this, function (_a) {
8877
- switch (_a.label) {
8867
+ return __generator(this, function (_b) {
8868
+ switch (_b.label) {
8878
8869
  case 0:
8879
8870
  this._emitStatusEvent('ngw:preselect');
8880
8871
  promises = [];
@@ -8898,13 +8889,14 @@ var NgwMap = /** @class */ (function (_super) {
8898
8889
  getIdsPromise = Promise.all(promises);
8899
8890
  return [4 /*yield*/, getIdsPromise];
8900
8891
  case 1:
8901
- getIds = _a.sent();
8892
+ getIds = _b.sent();
8902
8893
  ids = [];
8903
- getIds.forEach(function (x) {
8894
+ for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
8895
+ x = getIds_1[_a];
8904
8896
  if (x) {
8905
- x.forEach(function (y) { return ids.push(y); });
8897
+ ids.push.apply(ids, x);
8906
8898
  }
8907
- });
8899
+ }
8908
8900
  if (!ids.length) {
8909
8901
  this._emitStatusEvent('ngw:select', null);
8910
8902
  return [2 /*return*/];
@@ -8944,6 +8936,9 @@ var NgwMap = /** @class */ (function (_super) {
8944
8936
  };
8945
8937
  return __assign(__assign({}, identify), { getIdentifyItems: getIdentifyItems_ });
8946
8938
  };
8939
+ NgwMap.prototype._getSelectListenersCount = function () {
8940
+ return this.emitter.listenerCount('ngw:select');
8941
+ };
8947
8942
  NgwMap.prototype._whiteLabel = function () {
8948
8943
  return __awaiter(this, void 0, void 0, function () {
8949
8944
  var container, logo;