@nextgis/ngw-leaflet 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-leaflet; version: 1.13.8; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.14.0; author: NextGIS */
2
2
  import 'leaflet/dist/leaflet.css';
3
3
  import { Icon } from 'leaflet';
4
4
  import { NgwMap } from '@nextgis/ngw-map';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.13.8; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.14.0; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -15955,7 +15955,7 @@ var NgwLeaflet = (function () {
15955
15955
  var ID$2 = 0;
15956
15956
  var OPTIONS$1 = {
15957
15957
  minZoom: 0,
15958
- maxZoom: 20,
15958
+ maxZoom: 22,
15959
15959
  paint: {
15960
15960
  color: '#0000ff',
15961
15961
  opacity: 0.4,
@@ -19959,7 +19959,7 @@ var NgwLeaflet = (function () {
19959
19959
  'resource=' +
19960
19960
  resourceId +
19961
19961
  '&simplification=' +
19962
- ((_b = options.simplification) !== null && _b !== void 0 ? _b : 8);
19962
+ ((_b = options.simplification) !== null && _b !== void 0 ? _b : 6);
19963
19963
  // url = baseUrl + '/api/resource/' + options.resourceId + '/{z}/{x}/{y}.mvt';
19964
19964
  return {
19965
19965
  url: url,
@@ -20038,29 +20038,13 @@ var NgwLeaflet = (function () {
20038
20038
  baseUrl: connector.options.baseUrl || '',
20039
20039
  });
20040
20040
  if (opt) {
20041
- var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 },
20042
- // @deprecated
20043
- layers: String(resourceId_1), resourceId: resourceId_1 });
20041
+ var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 }, layers: opt.layers || String(resourceId_1), resourceId: resourceId_1 });
20044
20042
  if (layerOptions.adapterOptions &&
20045
20043
  defined(layerOptions.adapterOptions.setViewDelay)) {
20046
20044
  layerAdapterOptions.setViewDelay =
20047
20045
  layerOptions.adapterOptions.setViewDelay;
20048
20046
  }
20049
20047
  _this.options = __assign(__assign({}, _this.options), layerAdapterOptions);
20050
- // if (true) {
20051
- // Object.defineProperty(this.options, 'layers', {
20052
- // get: () => {
20053
- // console.warn('Do not use `layers` in ImageAdapterOptions');
20054
- // return String(resourceId);
20055
- // },
20056
- // });
20057
- // Object.defineProperty(this.options, 'resourceId', {
20058
- // get: () => {
20059
- // console.warn('Do not use `resourceId` in ImageAdapterOptions');
20060
- // return resourceId;
20061
- // },
20062
- // });
20063
- // }
20064
20048
  }
20065
20049
  return _this;
20066
20050
  }
@@ -22731,13 +22715,14 @@ var NgwLeaflet = (function () {
22731
22715
  var _this = this;
22732
22716
  if (!this.$$selectFromNgwRaster) {
22733
22717
  this.$$selectFromNgwRaster = function (ev) {
22734
- var count = _this.emitter.listenerCount('ngw:select');
22718
+ var count = _this._getSelectListenersCount();
22735
22719
  if (count) {
22736
22720
  _this._selectFromNgwRaster(ev);
22737
22721
  }
22738
22722
  };
22739
22723
  this.$$selectFromNgwVector = function (ev) {
22740
- if (_this.emitter.listenerCount('ngw:select')) {
22724
+ var count = _this._getSelectListenersCount();
22725
+ if (count) {
22741
22726
  _this._selectFromNgwVector(ev);
22742
22727
  }
22743
22728
  };
@@ -22748,8 +22733,10 @@ var NgwLeaflet = (function () {
22748
22733
  NgwMap.prototype.disableSelection = function () {
22749
22734
  if (this.$$selectFromNgwRaster) {
22750
22735
  this.emitter.removeListener('click', this.$$selectFromNgwRaster);
22751
- this.emitter.removeListener('click', this._selectFromNgwVector);
22752
22736
  this.$$selectFromNgwRaster = undefined;
22737
+ }
22738
+ if (this.$$selectFromNgwVector) {
22739
+ this.emitter.removeListener('layer:click', this.$$selectFromNgwVector);
22753
22740
  this.$$selectFromNgwVector = undefined;
22754
22741
  }
22755
22742
  };
@@ -22905,7 +22892,11 @@ var NgwLeaflet = (function () {
22905
22892
  NgwMap.prototype._selectFromNgwVector = function (ev) {
22906
22893
  var _a;
22907
22894
  var layer = ev.layer;
22908
- // item property means layer is NgwResource
22895
+ var selectable = layer.options.selectable && this.isLayerVisible(layer);
22896
+ if (!selectable) {
22897
+ return undefined;
22898
+ }
22899
+ // Item property means layer is NgwResource
22909
22900
  var id = layer.item && layer.item.resource.id;
22910
22901
  var feature = ev.feature;
22911
22902
  if (id !== undefined && feature) {
@@ -22935,10 +22926,10 @@ var NgwLeaflet = (function () {
22935
22926
  };
22936
22927
  NgwMap.prototype._selectFromNgwRaster = function (ev) {
22937
22928
  return __awaiter(this, void 0, void 0, function () {
22938
- var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, pixelRadius, center, zoom, radius, selectPromise;
22929
+ var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
22939
22930
  var _this = this;
22940
- return __generator(this, function (_a) {
22941
- switch (_a.label) {
22931
+ return __generator(this, function (_b) {
22932
+ switch (_b.label) {
22942
22933
  case 0:
22943
22934
  this._emitStatusEvent('ngw:preselect');
22944
22935
  promises = [];
@@ -22962,13 +22953,14 @@ var NgwLeaflet = (function () {
22962
22953
  getIdsPromise = Promise.all(promises);
22963
22954
  return [4 /*yield*/, getIdsPromise];
22964
22955
  case 1:
22965
- getIds = _a.sent();
22956
+ getIds = _b.sent();
22966
22957
  ids = [];
22967
- getIds.forEach(function (x) {
22958
+ for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
22959
+ x = getIds_1[_a];
22968
22960
  if (x) {
22969
- x.forEach(function (y) { return ids.push(y); });
22961
+ ids.push.apply(ids, x);
22970
22962
  }
22971
- });
22963
+ }
22972
22964
  if (!ids.length) {
22973
22965
  this._emitStatusEvent('ngw:select', null);
22974
22966
  return [2 /*return*/];
@@ -23008,6 +23000,9 @@ var NgwLeaflet = (function () {
23008
23000
  };
23009
23001
  return __assign(__assign({}, identify), { getIdentifyItems: getIdentifyItems_ });
23010
23002
  };
23003
+ NgwMap.prototype._getSelectListenersCount = function () {
23004
+ return this.emitter.listenerCount('ngw:select');
23005
+ };
23011
23006
  NgwMap.prototype._whiteLabel = function () {
23012
23007
  return __awaiter(this, void 0, void 0, function () {
23013
23008
  var container, logo;
@@ -23995,7 +23990,6 @@ var NgwLeaflet = (function () {
23995
23990
  opacity: 1,
23996
23991
  isBack: false,
23997
23992
  minZoom: 0,
23998
- maxZoom: 18,
23999
23993
  pane: 'tilePane',
24000
23994
  headers: null,
24001
23995
  viewPortBuffer: 0,
@@ -24300,8 +24294,7 @@ var NgwLeaflet = (function () {
24300
24294
  }
24301
24295
  return WmsLayerBase;
24302
24296
  }(leafletSrc.exports.TileLayer.WMS));
24303
- var WmsLayer = makeRemote(WmsLayerBase);
24304
- // applyMixins(WmsLayer, [RemoteTileLayer]);
24297
+ var WmsLayer = makeRemote(WmsLayerBase);
24305
24298
 
24306
24299
  var WmsAdapter = /** @class */ (function (_super) {
24307
24300
  __extends(WmsAdapter, _super);