@nextgis/ngw-map 2.1.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-map; version: 2.1.1; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 2.2.3; author: NextGIS */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 2.1.1; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 2.2.3; author: NextGIS */
2
2
  var domain;
3
3
 
4
4
  // This constructor is used to store event handlers. Instantiating this is
@@ -1050,6 +1050,32 @@ function getIdentifyRadius(center, zoom, pixelRadius) {
1050
1050
  return radius;
1051
1051
  }
1052
1052
 
1053
+ function checkExtent(extent) {
1054
+ const [minLon, minLat, maxLon, maxLat] = extent;
1055
+ const isOrderValid = minLon < maxLon && minLat < maxLat;
1056
+ if (!isOrderValid) {
1057
+ console.log("Error: The extent coordinates are not in the correct order.");
1058
+ console.log(
1059
+ `Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
1060
+ );
1061
+ const correctedExtent = [
1062
+ Math.min(minLon, maxLon),
1063
+ Math.min(minLat, maxLat),
1064
+ Math.max(minLon, maxLon),
1065
+ Math.max(maxLat, minLat)
1066
+ ];
1067
+ console.log(`Expected order: [${correctedExtent.join(", ")}]`);
1068
+ }
1069
+ const isValidLon = minLon >= -180 && maxLon <= 180;
1070
+ const isValidLat = minLat >= -90 && maxLat <= 90;
1071
+ if (!isValidLon || !isValidLat) {
1072
+ console.log(
1073
+ "Warning: The coordinates may not be within valid geographic ranges."
1074
+ );
1075
+ }
1076
+ return isOrderValid && isValidLon && isValidLat;
1077
+ }
1078
+
1053
1079
  function isEqual(a, b, o, p) {
1054
1080
  if (a instanceof Array) {
1055
1081
  if (!(b instanceof Array))
@@ -7405,6 +7431,7 @@ const _WebMapMain = class _WebMapMain {
7405
7431
  * ```
7406
7432
  */
7407
7433
  fitBounds(bounds, options) {
7434
+ checkExtent(bounds);
7408
7435
  if (bounds.every((x) => defined(x))) {
7409
7436
  if (bounds[1] < -85.06) {
7410
7437
  bounds[1] = -85.06;
@@ -8522,6 +8549,13 @@ class WebMapLayers extends WebMapMain {
8522
8549
  return Promise.resolve(options);
8523
8550
  });
8524
8551
  }
8552
+ _onLayerDoubleClick(options) {
8553
+ return __async$5(this, null, function* () {
8554
+ const id = options.layer.id;
8555
+ this._emitLayerEvent("layer:dblclick", id || "", options);
8556
+ return Promise.resolve(options);
8557
+ });
8558
+ }
8525
8559
  _onLayerSelect(options) {
8526
8560
  return __async$5(this, null, function* () {
8527
8561
  this._emitLayerEvent("layer:select", options.layer.id || "", options);
@@ -8533,17 +8567,25 @@ class WebMapLayers extends WebMapMain {
8533
8567
  onSelect,
8534
8568
  onLayerSelect,
8535
8569
  onClick,
8570
+ onDoubleClick,
8536
8571
  onLayerClick,
8537
8572
  onMouseOut,
8538
8573
  onMouseOver
8539
8574
  } = options;
8540
8575
  const onLayerClickFromOpt = onClick || onLayerClick;
8576
+ const onLayerDblClickFromOpt = onDoubleClick || onLayerClick;
8541
8577
  options.onClick = (e) => {
8542
8578
  if (onLayerClickFromOpt) {
8543
8579
  onLayerClickFromOpt(e);
8544
8580
  }
8545
8581
  return this._onLayerClick(e);
8546
8582
  };
8583
+ options.onDoubleClick = (e) => {
8584
+ if (onLayerDblClickFromOpt) {
8585
+ onLayerDblClickFromOpt(e);
8586
+ }
8587
+ return this._onLayerDoubleClick(e);
8588
+ };
8547
8589
  options.onMouseOut = (e) => {
8548
8590
  const id = e.layer.id;
8549
8591
  onMouseOut && onMouseOut(e);