@nextgis/leaflet-map-adapter 2.2.2 → 2.3.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/leaflet-map-adapter; version: 2.2.2; author: NextGIS */
1
+ /** Bundle of @nextgis/leaflet-map-adapter; version: 2.3.0; author: NextGIS */
2
2
  import { EventEmitter } from 'events';
3
3
  import { Control, DomEvent, GeoJSON, DivIcon, Marker, CircleMarker, FeatureGroup, ImageOverlay as ImageOverlay$1, Layer, Util, CRS, GridLayer, DomUtil, TileLayer as TileLayer$1, Map, latLngBounds, latLng } from 'leaflet';
4
4
  import { defined, debounce as debounce$1 } from '@nextgis/utils';
@@ -202,10 +202,7 @@ function createFeaturePositionOptions(features) {
202
202
 
203
203
  var __defProp$b = Object.defineProperty;
204
204
  var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
205
- var __publicField$7 = (obj, key, value) => {
206
- __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
207
- return value;
208
- };
205
+ var __publicField$7 = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
209
206
  class BaseAdapter {
210
207
  constructor(map, options) {
211
208
  this.map = map;
@@ -287,20 +284,18 @@ var __spreadValues$7 = (a, b) => {
287
284
  }
288
285
  return a;
289
286
  };
290
- var __publicField$6 = (obj, key, value) => {
291
- __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
292
- return value;
293
- };
287
+ var __publicField$6 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
294
288
  class GeoJsonEvents {
295
289
  constructor(layer) {
296
290
  __publicField$6(this, "layer");
297
291
  __publicField$6(this, "_onclick");
292
+ __publicField$6(this, "_ondblclick");
298
293
  __publicField$6(this, "_mouseout");
299
294
  __publicField$6(this, "_mouseover");
300
295
  this.layer = layer;
301
296
  }
302
297
  handleMouseEvents(layer) {
303
- const { onClick, onLayerClick, onMouseOut, onMouseOver } = this.layer.options;
298
+ const { onClick, onDoubleClick, onLayerClick, onMouseOut, onMouseOver } = this.layer.options;
304
299
  const onClick_ = onClick || onLayerClick;
305
300
  if (onClick_) {
306
301
  this._onclick = (e) => {
@@ -311,6 +306,16 @@ class GeoJsonEvents {
311
306
  };
312
307
  layer.on("click", this._onclick, this);
313
308
  }
309
+ if (onDoubleClick) {
310
+ this._ondblclick = (e) => {
311
+ DomEvent.stopPropagation(e);
312
+ const selected = !!this.layer._getSelected(layer);
313
+ onDoubleClick(__spreadValues$7({
314
+ selected
315
+ }, this._createMouseEvent(e)));
316
+ };
317
+ layer.on("dblclick", this._ondblclick, this);
318
+ }
314
319
  if (onMouseOut) {
315
320
  this._mouseout = (e) => {
316
321
  onMouseOut(this._createMouseEvent(e));
@@ -374,10 +379,7 @@ var __objRest$2 = (source, exclude) => {
374
379
  }
375
380
  return target;
376
381
  };
377
- var __publicField$5 = (obj, key, value) => {
378
- __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
379
- return value;
380
- };
382
+ var __publicField$5 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
381
383
  class GeoJsonPaint {
382
384
  constructor(layer) {
383
385
  __publicField$5(this, "layer");
@@ -526,10 +528,7 @@ var __spreadValues$5 = (a, b) => {
526
528
  return a;
527
529
  };
528
530
  var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
529
- var __publicField$4 = (obj, key, value) => {
530
- __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
531
- return value;
532
- };
531
+ var __publicField$4 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
533
532
  var __async = (__this, __arguments, generator) => {
534
533
  return new Promise((resolve, reject) => {
535
534
  var fulfilled = (value) => {
@@ -1115,14 +1114,10 @@ function callAjax(src, headers) {
1115
1114
  }
1116
1115
 
1117
1116
  const imageQueue = new Queue({ concurrency: 6, delay: 200 });
1118
- var imageQueue$1 = imageQueue;
1119
1117
 
1120
1118
  var __defProp$6 = Object.defineProperty;
1121
1119
  var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1122
- var __publicField$3 = (obj, key, value) => {
1123
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
1124
- return value;
1125
- };
1120
+ var __publicField$3 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
1126
1121
  class ImageOverlay extends ImageOverlay$1 {
1127
1122
  constructor(imageUrl, bounds, options) {
1128
1123
  super(imageUrl, bounds, options);
@@ -1140,7 +1135,7 @@ class ImageOverlay extends ImageOverlay$1 {
1140
1135
  const img = this._image;
1141
1136
  const src = img.src;
1142
1137
  img.src = "";
1143
- imageQueue$1.add(() => {
1138
+ imageQueue.add(() => {
1144
1139
  const [promise, abortFunc] = callAjax(src, headers);
1145
1140
  promise.then((imgUrl) => {
1146
1141
  img.src = imgUrl;
@@ -1153,10 +1148,7 @@ class ImageOverlay extends ImageOverlay$1 {
1153
1148
 
1154
1149
  var __defProp$5 = Object.defineProperty;
1155
1150
  var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1156
- var __publicField$2 = (obj, key, value) => {
1157
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
1158
- return value;
1159
- };
1151
+ var __publicField$2 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
1160
1152
  class ImageLayer extends Layer {
1161
1153
  constructor(url, options) {
1162
1154
  super(options);
@@ -1360,10 +1352,7 @@ var __spreadValues$4 = (a, b) => {
1360
1352
  }
1361
1353
  return a;
1362
1354
  };
1363
- var __publicField$1 = (obj, key, value) => {
1364
- __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
1365
- return value;
1366
- };
1355
+ var __publicField$1 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
1367
1356
  class ImageAdapter extends BaseAdapter {
1368
1357
  constructor() {
1369
1358
  super(...arguments);
@@ -1390,7 +1379,7 @@ class ImageAdapter extends BaseAdapter {
1390
1379
  }
1391
1380
  }
1392
1381
  }
1393
- __publicField$1(ImageAdapter, "queue", imageQueue$1);
1382
+ __publicField$1(ImageAdapter, "queue", imageQueue);
1394
1383
 
1395
1384
  function debounce(cb, wait = 10) {
1396
1385
  let timeoutId;
@@ -1659,10 +1648,7 @@ var __spreadValues = (a, b) => {
1659
1648
  }
1660
1649
  return a;
1661
1650
  };
1662
- var __publicField = (obj, key, value) => {
1663
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1664
- return value;
1665
- };
1651
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1666
1652
  const _LeafletMapAdapter = class _LeafletMapAdapter {
1667
1653
  constructor() {
1668
1654
  __publicField(this, "options", { target: "map" });
@@ -1740,8 +1726,7 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
1740
1726
  }
1741
1727
  setView(lngLatOrOpt, zoom) {
1742
1728
  const map = this.map;
1743
- if (!map)
1744
- return;
1729
+ if (!map) return;
1745
1730
  if (Array.isArray(lngLatOrOpt)) {
1746
1731
  const lngLat = lngLatOrOpt;
1747
1732
  const [lng, lat] = lngLat;
@@ -1809,8 +1794,7 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
1809
1794
  return (_a = this.map && this.map.getZoom()) != null ? _a : void 0;
1810
1795
  }
1811
1796
  getBounds() {
1812
- if (!this.map)
1813
- return void 0;
1797
+ if (!this.map) return void 0;
1814
1798
  const b = this.map.getBounds();
1815
1799
  const sw = b.getSouthWest();
1816
1800
  const ne = b.getNorthEast();