@nextgis/ngw-leaflet 2.2.1 → 2.2.3

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: 2.2.1; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 2.2.3; author: NextGIS */
2
2
  function styleInject(css, ref) {
3
3
  if ( ref === void 0 ) ref = {};
4
4
  var insertAt = ref.insertAt;
@@ -14857,6 +14857,32 @@ function getIdentifyRadius(center, zoom, pixelRadius) {
14857
14857
  return radius;
14858
14858
  }
14859
14859
 
14860
+ function checkExtent(extent) {
14861
+ const [minLon, minLat, maxLon, maxLat] = extent;
14862
+ const isOrderValid = minLon < maxLon && minLat < maxLat;
14863
+ if (!isOrderValid) {
14864
+ console.log("Error: The extent coordinates are not in the correct order.");
14865
+ console.log(
14866
+ `Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
14867
+ );
14868
+ const correctedExtent = [
14869
+ Math.min(minLon, maxLon),
14870
+ Math.min(minLat, maxLat),
14871
+ Math.max(minLon, maxLon),
14872
+ Math.max(maxLat, minLat)
14873
+ ];
14874
+ console.log(`Expected order: [${correctedExtent.join(", ")}]`);
14875
+ }
14876
+ const isValidLon = minLon >= -180 && maxLon <= 180;
14877
+ const isValidLat = minLat >= -90 && maxLat <= 90;
14878
+ if (!isValidLon || !isValidLat) {
14879
+ console.log(
14880
+ "Warning: The coordinates may not be within valid geographic ranges."
14881
+ );
14882
+ }
14883
+ return isOrderValid && isValidLon && isValidLat;
14884
+ }
14885
+
14860
14886
  function isEqual(a, b, o, p) {
14861
14887
  if (a instanceof Array) {
14862
14888
  if (!(b instanceof Array))
@@ -15123,12 +15149,13 @@ class GeoJsonEvents {
15123
15149
  constructor(layer) {
15124
15150
  __publicField$H(this, "layer");
15125
15151
  __publicField$H(this, "_onclick");
15152
+ __publicField$H(this, "_ondblclick");
15126
15153
  __publicField$H(this, "_mouseout");
15127
15154
  __publicField$H(this, "_mouseover");
15128
15155
  this.layer = layer;
15129
15156
  }
15130
15157
  handleMouseEvents(layer) {
15131
- const { onClick, onLayerClick, onMouseOut, onMouseOver } = this.layer.options;
15158
+ const { onClick, onDoubleClick, onLayerClick, onMouseOut, onMouseOver } = this.layer.options;
15132
15159
  const onClick_ = onClick || onLayerClick;
15133
15160
  if (onClick_) {
15134
15161
  this._onclick = (e) => {
@@ -15139,6 +15166,16 @@ class GeoJsonEvents {
15139
15166
  };
15140
15167
  layer.on("click", this._onclick, this);
15141
15168
  }
15169
+ if (onDoubleClick) {
15170
+ this._ondblclick = (e) => {
15171
+ leafletSrcExports.DomEvent.stopPropagation(e);
15172
+ const selected = !!this.layer._getSelected(layer);
15173
+ onDoubleClick(__spreadValues$C({
15174
+ selected
15175
+ }, this._createMouseEvent(e)));
15176
+ };
15177
+ layer.on("dblclick", this._ondblclick, this);
15178
+ }
15142
15179
  if (onMouseOut) {
15143
15180
  this._mouseout = (e) => {
15144
15181
  onMouseOut(this._createMouseEvent(e));
@@ -17016,9 +17053,10 @@ class ImageOverlay extends leafletSrcExports.ImageOverlay {
17016
17053
  super._initImage();
17017
17054
  const headers = this.options.headers;
17018
17055
  const img = this._image;
17056
+ const src = img.src;
17019
17057
  img.src = "";
17020
17058
  imageQueue.add(() => {
17021
- const [promise, abortFunc] = callAjax(img.src, headers);
17059
+ const [promise, abortFunc] = callAjax(src, headers);
17022
17060
  promise.then((imgUrl) => {
17023
17061
  img.src = imgUrl;
17024
17062
  });
@@ -23568,6 +23606,7 @@ const _WebMapMain = class _WebMapMain {
23568
23606
  * ```
23569
23607
  */
23570
23608
  fitBounds(bounds, options) {
23609
+ checkExtent(bounds);
23571
23610
  if (bounds.every((x) => defined(x))) {
23572
23611
  if (bounds[1] < -85.06) {
23573
23612
  bounds[1] = -85.06;
@@ -24685,6 +24724,13 @@ class WebMapLayers extends WebMapMain {
24685
24724
  return Promise.resolve(options);
24686
24725
  });
24687
24726
  }
24727
+ _onLayerDoubleClick(options) {
24728
+ return __async$4(this, null, function* () {
24729
+ const id = options.layer.id;
24730
+ this._emitLayerEvent("layer:dblclick", id || "", options);
24731
+ return Promise.resolve(options);
24732
+ });
24733
+ }
24688
24734
  _onLayerSelect(options) {
24689
24735
  return __async$4(this, null, function* () {
24690
24736
  this._emitLayerEvent("layer:select", options.layer.id || "", options);
@@ -24696,17 +24742,25 @@ class WebMapLayers extends WebMapMain {
24696
24742
  onSelect,
24697
24743
  onLayerSelect,
24698
24744
  onClick,
24745
+ onDoubleClick,
24699
24746
  onLayerClick,
24700
24747
  onMouseOut,
24701
24748
  onMouseOver
24702
24749
  } = options;
24703
24750
  const onLayerClickFromOpt = onClick || onLayerClick;
24751
+ const onLayerDblClickFromOpt = onDoubleClick || onLayerClick;
24704
24752
  options.onClick = (e) => {
24705
24753
  if (onLayerClickFromOpt) {
24706
24754
  onLayerClickFromOpt(e);
24707
24755
  }
24708
24756
  return this._onLayerClick(e);
24709
24757
  };
24758
+ options.onDoubleClick = (e) => {
24759
+ if (onLayerDblClickFromOpt) {
24760
+ onLayerDblClickFromOpt(e);
24761
+ }
24762
+ return this._onLayerDoubleClick(e);
24763
+ };
24710
24764
  options.onMouseOut = (e) => {
24711
24765
  const id = e.layer.id;
24712
24766
  onMouseOut && onMouseOut(e);