@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
  import 'leaflet/dist/leaflet.css';
3
3
  import LeafletMapAdapter from '@nextgis/leaflet-map-adapter';
4
4
  import { NgwMap } from '@nextgis/ngw-map';
@@ -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
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -14860,6 +14860,32 @@ var NgwLeaflet = (function () {
14860
14860
  return radius;
14861
14861
  }
14862
14862
 
14863
+ function checkExtent(extent) {
14864
+ const [minLon, minLat, maxLon, maxLat] = extent;
14865
+ const isOrderValid = minLon < maxLon && minLat < maxLat;
14866
+ if (!isOrderValid) {
14867
+ console.log("Error: The extent coordinates are not in the correct order.");
14868
+ console.log(
14869
+ `Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
14870
+ );
14871
+ const correctedExtent = [
14872
+ Math.min(minLon, maxLon),
14873
+ Math.min(minLat, maxLat),
14874
+ Math.max(minLon, maxLon),
14875
+ Math.max(maxLat, minLat)
14876
+ ];
14877
+ console.log(`Expected order: [${correctedExtent.join(", ")}]`);
14878
+ }
14879
+ const isValidLon = minLon >= -180 && maxLon <= 180;
14880
+ const isValidLat = minLat >= -90 && maxLat <= 90;
14881
+ if (!isValidLon || !isValidLat) {
14882
+ console.log(
14883
+ "Warning: The coordinates may not be within valid geographic ranges."
14884
+ );
14885
+ }
14886
+ return isOrderValid && isValidLon && isValidLat;
14887
+ }
14888
+
14863
14889
  function isEqual(a, b, o, p) {
14864
14890
  if (a instanceof Array) {
14865
14891
  if (!(b instanceof Array))
@@ -15126,12 +15152,13 @@ var NgwLeaflet = (function () {
15126
15152
  constructor(layer) {
15127
15153
  __publicField$H(this, "layer");
15128
15154
  __publicField$H(this, "_onclick");
15155
+ __publicField$H(this, "_ondblclick");
15129
15156
  __publicField$H(this, "_mouseout");
15130
15157
  __publicField$H(this, "_mouseover");
15131
15158
  this.layer = layer;
15132
15159
  }
15133
15160
  handleMouseEvents(layer) {
15134
- const { onClick, onLayerClick, onMouseOut, onMouseOver } = this.layer.options;
15161
+ const { onClick, onDoubleClick, onLayerClick, onMouseOut, onMouseOver } = this.layer.options;
15135
15162
  const onClick_ = onClick || onLayerClick;
15136
15163
  if (onClick_) {
15137
15164
  this._onclick = (e) => {
@@ -15142,6 +15169,16 @@ var NgwLeaflet = (function () {
15142
15169
  };
15143
15170
  layer.on("click", this._onclick, this);
15144
15171
  }
15172
+ if (onDoubleClick) {
15173
+ this._ondblclick = (e) => {
15174
+ leafletSrcExports.DomEvent.stopPropagation(e);
15175
+ const selected = !!this.layer._getSelected(layer);
15176
+ onDoubleClick(__spreadValues$C({
15177
+ selected
15178
+ }, this._createMouseEvent(e)));
15179
+ };
15180
+ layer.on("dblclick", this._ondblclick, this);
15181
+ }
15145
15182
  if (onMouseOut) {
15146
15183
  this._mouseout = (e) => {
15147
15184
  onMouseOut(this._createMouseEvent(e));
@@ -23572,6 +23609,7 @@ var NgwLeaflet = (function () {
23572
23609
  * ```
23573
23610
  */
23574
23611
  fitBounds(bounds, options) {
23612
+ checkExtent(bounds);
23575
23613
  if (bounds.every((x) => defined(x))) {
23576
23614
  if (bounds[1] < -85.06) {
23577
23615
  bounds[1] = -85.06;
@@ -24689,6 +24727,13 @@ var NgwLeaflet = (function () {
24689
24727
  return Promise.resolve(options);
24690
24728
  });
24691
24729
  }
24730
+ _onLayerDoubleClick(options) {
24731
+ return __async$4(this, null, function* () {
24732
+ const id = options.layer.id;
24733
+ this._emitLayerEvent("layer:dblclick", id || "", options);
24734
+ return Promise.resolve(options);
24735
+ });
24736
+ }
24692
24737
  _onLayerSelect(options) {
24693
24738
  return __async$4(this, null, function* () {
24694
24739
  this._emitLayerEvent("layer:select", options.layer.id || "", options);
@@ -24700,17 +24745,25 @@ var NgwLeaflet = (function () {
24700
24745
  onSelect,
24701
24746
  onLayerSelect,
24702
24747
  onClick,
24748
+ onDoubleClick,
24703
24749
  onLayerClick,
24704
24750
  onMouseOut,
24705
24751
  onMouseOver
24706
24752
  } = options;
24707
24753
  const onLayerClickFromOpt = onClick || onLayerClick;
24754
+ const onLayerDblClickFromOpt = onDoubleClick || onLayerClick;
24708
24755
  options.onClick = (e) => {
24709
24756
  if (onLayerClickFromOpt) {
24710
24757
  onLayerClickFromOpt(e);
24711
24758
  }
24712
24759
  return this._onLayerClick(e);
24713
24760
  };
24761
+ options.onDoubleClick = (e) => {
24762
+ if (onLayerDblClickFromOpt) {
24763
+ onLayerDblClickFromOpt(e);
24764
+ }
24765
+ return this._onLayerDoubleClick(e);
24766
+ };
24714
24767
  options.onMouseOut = (e) => {
24715
24768
  const id = e.layer.id;
24716
24769
  onMouseOut && onMouseOut(e);