@nextgis/leaflet-map-adapter 4.0.1 → 4.0.2

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: 4.0.1; author: NextGIS */
1
+ /** Bundle of @nextgis/leaflet-map-adapter; version: 4.0.2; author: NextGIS */
2
2
  import { LeafletControlContainer, createControl, createButtonControl, createToggleControl } from '@nextgis/leaflet-control-container';
3
3
  import { EventEmitter } from 'events';
4
4
  import { Control, GeoJSON, DomEvent, DivIcon, Marker, CircleMarker, FeatureGroup, ImageOverlay as ImageOverlay$1, Layer, Util, GridLayer, DomUtil, TileLayer as TileLayer$1, Map, latLngBounds, latLng } from 'leaflet';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/leaflet-map-adapter; version: 4.0.1; author: NextGIS */
1
+ /** Bundle of @nextgis/leaflet-map-adapter; version: 4.0.2; author: NextGIS */
2
2
  var LeafletMapAdapter = (function () {
3
3
  'use strict';
4
4
 
@@ -15371,8 +15371,14 @@ var LeafletMapAdapter = (function () {
15371
15371
  }
15372
15372
 
15373
15373
  function updateUrlParams(urlStr, params) {
15374
- const url = new URL(urlStr);
15375
- const searchParams = new URLSearchParams(url.search);
15374
+ const hashIndex = urlStr.indexOf("#");
15375
+ const hash = hashIndex === -1 ? "" : urlStr.slice(hashIndex);
15376
+ const url = hashIndex === -1 ? urlStr : urlStr.slice(0, hashIndex);
15377
+ const queryIndex = url.indexOf("?");
15378
+ const baseUrl = queryIndex === -1 ? url : url.slice(0, queryIndex);
15379
+ const searchParams = new URLSearchParams(
15380
+ queryIndex === -1 ? "" : url.slice(queryIndex + 1)
15381
+ );
15376
15382
  Object.entries(params).forEach(([key, value]) => {
15377
15383
  if (value === void 0) {
15378
15384
  searchParams.delete(key);
@@ -15382,7 +15388,7 @@ var LeafletMapAdapter = (function () {
15382
15388
  });
15383
15389
  searchParams.set("timestamp", String((/* @__PURE__ */ new Date()).getTime()));
15384
15390
  const newSearch = [...searchParams.entries()].map(([key, value]) => `${key}=${value}`).join("&");
15385
- return `${url.origin}${url.pathname}?${newSearch}`;
15391
+ return `${baseUrl}?${newSearch}${hash}`;
15386
15392
  }
15387
15393
 
15388
15394
  function boundsToArray(bounds) {