@nextgis/ngw-leaflet 1.15.0 → 1.16.1

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.15.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.16.1; 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.15.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.16.1; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -15266,7 +15266,9 @@ var NgwLeaflet = (function () {
15266
15266
 
15267
15267
  var d2r = Math.PI / 180; // degrees to radians
15268
15268
  var r2d = 180 / Math.PI; // radians to degrees
15269
- function getCirclePolygonCoordinates(lng, lat, radius, points) {
15269
+ function getCirclePolygonCoordinates(lng, lat,
15270
+ /** In kilometers */
15271
+ radius, points) {
15270
15272
  if (radius === void 0) { radius = 10; }
15271
15273
  if (points === void 0) { points = 6; }
15272
15274
  // find the radius in lat/lon
@@ -15316,6 +15318,14 @@ var NgwLeaflet = (function () {
15316
15318
  array.every(function (x) { return typeof x === 'number'; }));
15317
15319
  }
15318
15320
 
15321
+ function getIdentifyRadius(center, zoom, pixelRadius) {
15322
+ pixelRadius = pixelRadius !== null && pixelRadius !== void 0 ? pixelRadius : 10;
15323
+ var metresPerPixel = (40075016.686 * Math.abs(Math.cos((center[1] * 180) / Math.PI))) /
15324
+ Math.pow(2, zoom + 8);
15325
+ var radius = pixelRadius * metresPerPixel * 0.0005;
15326
+ return radius;
15327
+ }
15328
+
15319
15329
  /**
15320
15330
  * Copy the values of all of the enumerable own properties from one or more source objects to a
15321
15331
  * target object. Returns the target object.
@@ -15616,6 +15626,24 @@ var NgwLeaflet = (function () {
15616
15626
  return mask;
15617
15627
  };
15618
15628
  }
15629
+ function expressionCallback(paint, defaultPaint, getPaintFunctions) {
15630
+ var expressionCallback = createExpressionCallback(paint);
15631
+ if (expressionCallback) {
15632
+ var expressionPaintCb = function (feature) {
15633
+ return preparePaint(expressionCallback(feature), defaultPaint, getPaintFunctions);
15634
+ };
15635
+ expressionPaintCb.paint = paint;
15636
+ return expressionPaintCb;
15637
+ }
15638
+ var newPaint = __assign({}, defaultPaint);
15639
+ newPaint = __assign(__assign({}, newPaint), paint);
15640
+ newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
15641
+ newPaint.stroke =
15642
+ newPaint.stroke !== undefined
15643
+ ? newPaint.stroke
15644
+ : !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
15645
+ return newPaint;
15646
+ }
15619
15647
  function preparePaint(paint, defaultPaint, getPaintFunctions) {
15620
15648
  if (!paint) {
15621
15649
  throw new Error('paint is empty');
@@ -15645,20 +15673,7 @@ var NgwLeaflet = (function () {
15645
15673
  return paint;
15646
15674
  }
15647
15675
  else {
15648
- var expressionCallback_1 = createExpressionCallback(paint);
15649
- if (expressionCallback_1) {
15650
- var expressionPaintCb = function (feature) {
15651
- return preparePaint(expressionCallback_1(feature), defaultPaint, getPaintFunctions);
15652
- };
15653
- expressionPaintCb.paint = paint;
15654
- return expressionPaintCb;
15655
- }
15656
- newPaint = __assign(__assign({}, newPaint), paint);
15657
- newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
15658
- newPaint.stroke =
15659
- newPaint.stroke !== undefined
15660
- ? newPaint.stroke
15661
- : !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
15676
+ newPaint = expressionCallback(paint, defaultPaint, getPaintFunctions);
15662
15677
  }
15663
15678
  if (isPaintCallback(newPaint)) {
15664
15679
  return newPaint;
@@ -18720,6 +18735,9 @@ var NgwLeaflet = (function () {
18720
18735
  if (this.options.route) {
18721
18736
  this.routeStr = this.options.route;
18722
18737
  }
18738
+ if (this.options.requestTransform) {
18739
+ this.requestTransform = this.options.requestTransform;
18740
+ }
18723
18741
  this.resources = new ResourcesControl(this);
18724
18742
  addConnector(this);
18725
18743
  }
@@ -18727,6 +18745,9 @@ var NgwLeaflet = (function () {
18727
18745
  NgwConnector.create = function (options) {
18728
18746
  return new this(options);
18729
18747
  };
18748
+ NgwConnector.prototype.setRequestTransform = function (requestTransform) {
18749
+ this.requestTransform = requestTransform;
18750
+ };
18730
18751
  /**
18731
18752
  * Fast way to specify the connection address to NextGIS Web.
18732
18753
  * The current connection will be severed.
@@ -18986,9 +19007,8 @@ var NgwLeaflet = (function () {
18986
19007
  if (params) {
18987
19008
  url = template(url, params);
18988
19009
  }
18989
- // remove double slash
18990
- url = fixUrlStr(url);
18991
- return this._loadData(encodeURI(url), options);
19010
+ url = encodeURI(fixUrlStr(url));
19011
+ return this._loadData(url, options);
18992
19012
  }
18993
19013
  else {
18994
19014
  throw new Error('Empty `url` not allowed');
@@ -19081,6 +19101,11 @@ var NgwLeaflet = (function () {
19081
19101
  // options.withCredentials = true;
19082
19102
  options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
19083
19103
  }
19104
+ if (_this.requestTransform) {
19105
+ var _a = _this.requestTransform(url, options), transUrl = _a[0], transOptions = _a[1];
19106
+ url = transUrl;
19107
+ options = transOptions;
19108
+ }
19084
19109
  loadData(url, resolve, options, reject, onCancel);
19085
19110
  })
19086
19111
  .then(function (resp) {
@@ -19105,6 +19130,7 @@ var NgwLeaflet = (function () {
19105
19130
  typeof options.signal.addEventListener === 'function') {
19106
19131
  options.signal.addEventListener('abort', function () {
19107
19132
  request.cancel();
19133
+ _this._cleanActiveRequests(request);
19108
19134
  });
19109
19135
  }
19110
19136
  this.activeRequests.push(request);
@@ -20695,10 +20721,12 @@ var NgwLeaflet = (function () {
20695
20721
  };
20696
20722
  if (item.item_type === 'group' || item.item_type === 'root') {
20697
20723
  if (item.children && item.children.length) {
20698
- this.getChildren(item).forEach(function (x) {
20699
- var children = new NgwWebmapItem(_this.webMap, x, _this.options, _this.connector, _this);
20700
- _this.tree.addChild(children);
20701
- });
20724
+ var children = this.getChildren(item);
20725
+ for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
20726
+ var x = children_1[_i];
20727
+ var children_2 = new this.constructor(this.webMap, x, this.options, this.connector, this);
20728
+ this.tree.addChild(children_2);
20729
+ }
20702
20730
  }
20703
20731
  return Promise.resolve();
20704
20732
  }
@@ -20739,7 +20767,7 @@ var NgwLeaflet = (function () {
20739
20767
  headers: this.options.headers,
20740
20768
  crossOrigin: this.options.crossOrigin,
20741
20769
  setViewDelay: this.options.setViewDelay,
20742
- params: { resource: this.item.resourceId },
20770
+ params: { resource: this.item.resourceId, item: this.item },
20743
20771
  };
20744
20772
  if (this.options.order) {
20745
20773
  var subOrder = this.options.drawOrderEnabled && 'draw_order_position' in item
@@ -20750,6 +20778,9 @@ var NgwLeaflet = (function () {
20750
20778
  var subLevel = String(subOrder).padStart(4, '0');
20751
20779
  options.order = Number((this.options.order | 0) + '.' + subLevel);
20752
20780
  }
20781
+ if (this.options.popupOptions) {
20782
+ options.popupOptions = this.options.popupOptions;
20783
+ }
20753
20784
  if (item.item_type === 'layer') {
20754
20785
  var _a = this._getZoomRange(item), maxZoom = _a.maxZoom, minZoom = _a.minZoom;
20755
20786
  objectAssign(options, {
@@ -20797,8 +20828,8 @@ var NgwLeaflet = (function () {
20797
20828
  };
20798
20829
  NgwWebmapItem.prototype._sumUp = function (children, totalValue) {
20799
20830
  if (totalValue === void 0) { totalValue = 0; }
20800
- for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
20801
- var child = children_1[_i];
20831
+ for (var _i = 0, children_3 = children; _i < children_3.length; _i++) {
20832
+ var child = children_3[_i];
20802
20833
  if (child.item_type === 'layer') {
20803
20834
  totalValue += 1;
20804
20835
  child.draw_order_position = child.draw_order_position || totalValue;
@@ -21105,8 +21136,6 @@ var NgwLeaflet = (function () {
21105
21136
  this._extent &&
21106
21137
  extentConstrained) {
21107
21138
  this.options.webMap.setView({ maxBounds: this._extent });
21108
- // @ts-ignore
21109
- window.webmap = this.options.webMap;
21110
21139
  }
21111
21140
  return [2 /*return*/, this.layer];
21112
21141
  }
@@ -21279,6 +21308,7 @@ var NgwLeaflet = (function () {
21279
21308
  options.minZoom = _this.options.minZoom;
21280
21309
  options.maxZoom = _this.options.maxZoom;
21281
21310
  options.drawOrderEnabled = webmap_1.draw_order_enabled;
21311
+ options.popupOptions = _this.options.popupOptions;
21282
21312
  var layer = new _this.NgwWebmapItem(_this.options.webMap, webmap_1.root_item, options, _this.options.connector);
21283
21313
  layer.emitter.on('init', function () { return resolve(layer); });
21284
21314
  })];
@@ -21409,30 +21439,34 @@ var NgwLeaflet = (function () {
21409
21439
  };
21410
21440
  NgwWebmapLayerAdapter.prototype._getWebMapIds = function () {
21411
21441
  return __awaiter(this, void 0, void 0, function () {
21412
- var webMapItem, layers, promises_1, ids;
21413
- var _this = this;
21442
+ var webMapItem, layers, promises, _loop_2, this_2, _i, layers_1, x, ids;
21414
21443
  return __generator(this, function (_a) {
21415
21444
  switch (_a.label) {
21416
21445
  case 0:
21417
21446
  webMapItem = this.layer;
21418
21447
  if (!(webMapItem && webMapItem.item.item_type === 'root')) return [3 /*break*/, 2];
21419
21448
  layers = webMapItem.tree.getDescendants();
21420
- promises_1 = [];
21421
- layers.forEach(function (x) {
21449
+ promises = [];
21450
+ _loop_2 = function (x) {
21422
21451
  var item = x.item;
21423
21452
  if (item.item_type === 'layer') {
21424
21453
  var id = item.layer_style_id;
21425
- var promise = _this.options.connector.getResource(id).then(function (y) {
21454
+ var promise = this_2.options.connector.getResource(id).then(function (y) {
21426
21455
  if (y) {
21427
21456
  var parentId = Number(y.resource.parent.id);
21428
21457
  item.parentId = parentId;
21429
21458
  return parentId;
21430
21459
  }
21431
21460
  });
21432
- promises_1.push(promise);
21461
+ promises.push(promise);
21433
21462
  }
21434
- });
21435
- return [4 /*yield*/, Promise.all(promises_1)];
21463
+ };
21464
+ this_2 = this;
21465
+ for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
21466
+ x = layers_1[_i];
21467
+ _loop_2(x);
21468
+ }
21469
+ return [4 /*yield*/, Promise.all(promises)];
21436
21470
  case 1:
21437
21471
  ids = _a.sent();
21438
21472
  return [2 /*return*/, ids.filter(function (x) { return x !== undefined; })];
@@ -22359,14 +22393,6 @@ var NgwLeaflet = (function () {
22359
22393
  return options;
22360
22394
  }
22361
22395
 
22362
- function getIdentifyRadius(center, zoom, pixelRadius) {
22363
- pixelRadius = pixelRadius !== null && pixelRadius !== void 0 ? pixelRadius : 10;
22364
- var metresPerPixel = (40075016.686 * Math.abs(Math.cos((center[1] * 180) / Math.PI))) /
22365
- Math.pow(2, zoom + 8);
22366
- var radius = pixelRadius * metresPerPixel * 0.0005;
22367
- return radius;
22368
- }
22369
-
22370
22396
  /**
22371
22397
  * Base class containing the logic of interaction WebMap with NextGIS services.
22372
22398
  *
@@ -22715,7 +22741,7 @@ var NgwLeaflet = (function () {
22715
22741
  this.$$selectFromNgwRaster = function (ev) {
22716
22742
  var count = _this._getSelectListenersCount();
22717
22743
  if (count) {
22718
- _this._selectFromNgwRaster(ev);
22744
+ _this.selectFromNgwRaster(ev);
22719
22745
  }
22720
22746
  };
22721
22747
  this.$$selectFromNgwVector = function (ev) {
@@ -22787,6 +22813,72 @@ var NgwLeaflet = (function () {
22787
22813
  }
22788
22814
  });
22789
22815
  };
22816
+ NgwMap.prototype.selectFromNgwRaster = function (ev) {
22817
+ return __awaiter(this, void 0, void 0, function () {
22818
+ var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
22819
+ var _this = this;
22820
+ return __generator(this, function (_b) {
22821
+ switch (_b.label) {
22822
+ case 0:
22823
+ this._emitStatusEvent('ngw:preselect');
22824
+ promises = [];
22825
+ layers = Object.values(this._ngwLayers);
22826
+ layers.sort(function (a, b) {
22827
+ if (a.layer.order && b.layer.order) {
22828
+ return b.layer.order - a.layer.order;
22829
+ }
22830
+ return 1;
22831
+ });
22832
+ for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
22833
+ l = layers_1[_i];
22834
+ layer = l.layer;
22835
+ identFunc = typeof layer.getIdentificationIds === 'function'
22836
+ ? layer.getIdentificationIds
22837
+ : false;
22838
+ if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
22839
+ promises.push(identFunc.call(layer));
22840
+ }
22841
+ }
22842
+ getIdsPromise = Promise.all(promises);
22843
+ return [4 /*yield*/, getIdsPromise];
22844
+ case 1:
22845
+ getIds = _b.sent();
22846
+ ids = [];
22847
+ for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
22848
+ x = getIds_1[_a];
22849
+ if (x) {
22850
+ ids.push.apply(ids, x);
22851
+ }
22852
+ }
22853
+ if (!ids.length) {
22854
+ this._emitStatusEvent('ngw:select', null);
22855
+ return [2 /*return*/];
22856
+ }
22857
+ pixelRadius = this.options.pixelRadius || 10;
22858
+ center = this.getCenter();
22859
+ zoom = this.getZoom();
22860
+ zoom = zoom !== undefined ? zoom : 20;
22861
+ if (!center || !zoom) {
22862
+ this._emitStatusEvent('ngw:select', null);
22863
+ return [2 /*return*/];
22864
+ }
22865
+ radius = getIdentifyRadius(center, zoom, pixelRadius);
22866
+ selectPromise = sendIdentifyRequest(ev, {
22867
+ layers: ids,
22868
+ connector: this.connector,
22869
+ radius: radius,
22870
+ }).then(function (resp) {
22871
+ var identify = __assign(__assign({}, resp), { resources: ids, sourceType: 'raster', event: ev });
22872
+ var identifyEvent = _this._prepareToIdentify(identify);
22873
+ _this._emitStatusEvent('ngw:select', identify);
22874
+ return identifyEvent;
22875
+ });
22876
+ this._addPromise('select', selectPromise);
22877
+ return [2 /*return*/, selectPromise];
22878
+ }
22879
+ });
22880
+ });
22881
+ };
22790
22882
  NgwMap.prototype._addPromise = function (groupName, promise) {
22791
22883
  var group = this._promises[groupName];
22792
22884
  if (group && group.indexOf(promise) === -1) {
@@ -22922,70 +23014,6 @@ var NgwLeaflet = (function () {
22922
23014
  }
22923
23015
  }
22924
23016
  };
22925
- NgwMap.prototype._selectFromNgwRaster = function (ev) {
22926
- return __awaiter(this, void 0, void 0, function () {
22927
- var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
22928
- var _this = this;
22929
- return __generator(this, function (_b) {
22930
- switch (_b.label) {
22931
- case 0:
22932
- this._emitStatusEvent('ngw:preselect');
22933
- promises = [];
22934
- layers = Object.values(this._ngwLayers);
22935
- layers.sort(function (a, b) {
22936
- if (a.layer.order && b.layer.order) {
22937
- return b.layer.order - a.layer.order;
22938
- }
22939
- return 1;
22940
- });
22941
- for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
22942
- l = layers_1[_i];
22943
- layer = l.layer;
22944
- identFunc = typeof layer.getIdentificationIds === 'function'
22945
- ? layer.getIdentificationIds
22946
- : false;
22947
- if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
22948
- promises.push(identFunc.call(layer));
22949
- }
22950
- }
22951
- getIdsPromise = Promise.all(promises);
22952
- return [4 /*yield*/, getIdsPromise];
22953
- case 1:
22954
- getIds = _b.sent();
22955
- ids = [];
22956
- for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
22957
- x = getIds_1[_a];
22958
- if (x) {
22959
- ids.push.apply(ids, x);
22960
- }
22961
- }
22962
- if (!ids.length) {
22963
- this._emitStatusEvent('ngw:select', null);
22964
- return [2 /*return*/];
22965
- }
22966
- pixelRadius = this.options.pixelRadius || 10;
22967
- center = this.getCenter();
22968
- zoom = this.getZoom();
22969
- zoom = zoom !== undefined ? zoom : 20;
22970
- if (!center || !zoom) {
22971
- this._emitStatusEvent('ngw:select', null);
22972
- return [2 /*return*/];
22973
- }
22974
- radius = getIdentifyRadius(center, zoom, pixelRadius);
22975
- selectPromise = sendIdentifyRequest(ev, {
22976
- layers: ids,
22977
- connector: this.connector,
22978
- radius: radius,
22979
- }).then(function (resp) {
22980
- _this._emitStatusEvent('ngw:select', _this._prepareToIdentify(__assign(__assign({}, resp), { resources: ids, sourceType: 'raster', event: ev })));
22981
- return resp;
22982
- });
22983
- this._addPromise('select', selectPromise);
22984
- return [2 /*return*/, selectPromise];
22985
- }
22986
- });
22987
- });
22988
- };
22989
23017
  NgwMap.prototype._prepareToIdentify = function (identify) {
22990
23018
  var _this = this;
22991
23019
  var getIdentifyItems_ = function () {
@@ -23298,12 +23326,13 @@ var NgwLeaflet = (function () {
23298
23326
  this._removeMapListener();
23299
23327
  };
23300
23328
  GeoJsonAdapter.prototype.select = function (findFeatureFun) {
23301
- var _this = this;
23329
+ this.unselect();
23302
23330
  if (findFeatureFun) {
23303
23331
  var def = this._layers.filter(findFeatureFun);
23304
- def.forEach(function (x) {
23305
- _this._selectLayer(x, 'api');
23306
- });
23332
+ for (var _i = 0, def_1 = def; _i < def_1.length; _i++) {
23333
+ var x = def_1[_i];
23334
+ this._selectLayer(x, 'api');
23335
+ }
23307
23336
  }
23308
23337
  else if (!this.selected) {
23309
23338
  this.selected = true;
@@ -23716,13 +23745,13 @@ var NgwLeaflet = (function () {
23716
23745
  var _this = this;
23717
23746
  var layer_ = this.layer;
23718
23747
  if (layer_) {
23719
- var def_1 = __assign({ target: this, feature: feature, layer: layer }, createFeaturePositionOptions(feature));
23748
+ var def_2 = __assign({ target: this, feature: feature, layer: layer }, createFeaturePositionOptions(feature));
23720
23749
  // @ts-ignore
23721
23750
  layer.options.pane = this.pane;
23722
- this._layers.push(def_1);
23751
+ this._layers.push(def_2);
23723
23752
  var ok = true;
23724
23753
  if (this._filterFun) {
23725
- ok = this._filterFun(def_1);
23754
+ ok = this._filterFun(def_2);
23726
23755
  }
23727
23756
  if (ok) {
23728
23757
  var _a = this.options, popup_1 = _a.popup, popupOptions_1 = _a.popupOptions, selectable = _a.selectable, interactive = _a.interactive, selectOnHover = _a.selectOnHover;
@@ -23732,10 +23761,10 @@ var NgwLeaflet = (function () {
23732
23761
  if (selectable) {
23733
23762
  if (selectOnHover) {
23734
23763
  layer.on('mouseover', function () {
23735
- _this._selectLayer(def_1, 'hover');
23764
+ _this._selectLayer(def_2, 'hover');
23736
23765
  });
23737
23766
  layer.on('mouseout', function () {
23738
- _this._unSelectLayer(def_1);
23767
+ _this._unSelectLayer(def_2);
23739
23768
  });
23740
23769
  }
23741
23770
  else {
@@ -23802,10 +23831,12 @@ var NgwLeaflet = (function () {
23802
23831
  };
23803
23832
  GeoJsonAdapter.prototype._selectLayer = function (def, type, latlng) {
23804
23833
  var _this = this;
23805
- this.map._addUnselectCb(function () {
23806
- _this._unSelectLayer(def);
23807
- });
23808
- if (this.options && !this.options.multiselect) {
23834
+ var multiselect = this.options.multiselect;
23835
+ if (!multiselect) {
23836
+ // To unselect layer on another layer click
23837
+ this.map._addUnselectCb(function () {
23838
+ _this._unSelectLayer(def);
23839
+ });
23809
23840
  this._selectedLayers.forEach(function (x) { return _this._unSelectLayer(x); });
23810
23841
  }
23811
23842
  this._selectedLayers.push(def);
@@ -23882,14 +23913,26 @@ var NgwLeaflet = (function () {
23882
23913
  }
23883
23914
  return geoJsonOptions;
23884
23915
  };
23885
- GeoJsonAdapter.prototype._addMapListener = function () {
23916
+ GeoJsonAdapter.prototype._addMapClickListener = function () {
23886
23917
  var map = this.map;
23887
23918
  if (map) {
23888
- var _a = this.options, labelField = _a.labelField, labelOnHover = _a.labelOnHover, unselectOnClick = _a.unselectOnClick;
23919
+ var unselectOnClick = this.options.unselectOnClick;
23889
23920
  var uoc = unselectOnClick !== null && unselectOnClick !== void 0 ? unselectOnClick : true;
23890
23921
  if (uoc) {
23891
23922
  map.on('click', this.$unselect);
23892
23923
  }
23924
+ }
23925
+ };
23926
+ GeoJsonAdapter.prototype._removeMapClickListener = function () {
23927
+ this.map.off('zoomend', this.$updateTooltip);
23928
+ this.map.off('moveend', this.$updateTooltip);
23929
+ this.map.off('click', this.$unselect);
23930
+ };
23931
+ GeoJsonAdapter.prototype._addMapListener = function () {
23932
+ var map = this.map;
23933
+ if (map) {
23934
+ var _a = this.options, labelField = _a.labelField, labelOnHover = _a.labelOnHover;
23935
+ this._addMapClickListener();
23893
23936
  if (labelField && !labelOnHover) {
23894
23937
  map.on('zoomend', this.$updateTooltip);
23895
23938
  map.on('moveend', this.$updateTooltip);
@@ -23897,9 +23940,9 @@ var NgwLeaflet = (function () {
23897
23940
  }
23898
23941
  };
23899
23942
  GeoJsonAdapter.prototype._removeMapListener = function () {
23943
+ this._removeMapClickListener();
23900
23944
  this.map.off('zoomend', this.$updateTooltip);
23901
23945
  this.map.off('moveend', this.$updateTooltip);
23902
- this.map.off('click', this.$unselect);
23903
23946
  };
23904
23947
  return GeoJsonAdapter;
23905
23948
  }(BaseAdapter));