@nextgis/ngw-leaflet 2.2.2 → 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.2; 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));
@@ -23569,6 +23606,7 @@ const _WebMapMain = class _WebMapMain {
23569
23606
  * ```
23570
23607
  */
23571
23608
  fitBounds(bounds, options) {
23609
+ checkExtent(bounds);
23572
23610
  if (bounds.every((x) => defined(x))) {
23573
23611
  if (bounds[1] < -85.06) {
23574
23612
  bounds[1] = -85.06;
@@ -24686,6 +24724,13 @@ class WebMapLayers extends WebMapMain {
24686
24724
  return Promise.resolve(options);
24687
24725
  });
24688
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
+ }
24689
24734
  _onLayerSelect(options) {
24690
24735
  return __async$4(this, null, function* () {
24691
24736
  this._emitLayerEvent("layer:select", options.layer.id || "", options);
@@ -24697,17 +24742,25 @@ class WebMapLayers extends WebMapMain {
24697
24742
  onSelect,
24698
24743
  onLayerSelect,
24699
24744
  onClick,
24745
+ onDoubleClick,
24700
24746
  onLayerClick,
24701
24747
  onMouseOut,
24702
24748
  onMouseOver
24703
24749
  } = options;
24704
24750
  const onLayerClickFromOpt = onClick || onLayerClick;
24751
+ const onLayerDblClickFromOpt = onDoubleClick || onLayerClick;
24705
24752
  options.onClick = (e) => {
24706
24753
  if (onLayerClickFromOpt) {
24707
24754
  onLayerClickFromOpt(e);
24708
24755
  }
24709
24756
  return this._onLayerClick(e);
24710
24757
  };
24758
+ options.onDoubleClick = (e) => {
24759
+ if (onLayerDblClickFromOpt) {
24760
+ onLayerDblClickFromOpt(e);
24761
+ }
24762
+ return this._onLayerDoubleClick(e);
24763
+ };
24711
24764
  options.onMouseOut = (e) => {
24712
24765
  const id = e.layer.id;
24713
24766
  onMouseOut && onMouseOut(e);