@nextgis/leaflet-map-adapter 3.0.0-alpha.3 → 3.0.0-alpha.4

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,7 +1,7 @@
1
- /** Bundle of @nextgis/leaflet-map-adapter; version: 3.0.0-alpha.3; author: NextGIS */
1
+ /** Bundle of @nextgis/leaflet-map-adapter; version: 3.0.0-alpha.4; author: NextGIS */
2
2
  import { EventEmitter } from 'events';
3
3
  import { Control, DomEvent, GeoJSON, DivIcon, Marker, CircleMarker, FeatureGroup, ImageOverlay as ImageOverlay$1, Layer, Util, CRS, GridLayer, DomUtil, TileLayer as TileLayer$1, Map, latLngBounds, latLng } from 'leaflet';
4
- import { defined, debounce as debounce$1 } from '@nextgis/utils';
4
+ import { defined, debounce as debounce$1, updateUrlParams } from '@nextgis/utils';
5
5
  import { isPaintCallback, isPaint } from '@nextgis/paint';
6
6
  import Queue from '@nextgis/queue';
7
7
 
@@ -1162,6 +1162,7 @@ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key,
1162
1162
  var __publicField$2 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
1163
1163
  class ImageLayer extends Layer {
1164
1164
  constructor(url, options) {
1165
+ var _a;
1165
1166
  super(options);
1166
1167
  __publicField$2(this, "defaultWmsParams", {
1167
1168
  service: "WMS",
@@ -1202,7 +1203,11 @@ class ImageLayer extends Layer {
1202
1203
  }
1203
1204
  }
1204
1205
  Util.setOptions(this, opts);
1205
- this.wmsParams = Util.extend({}, this.defaultWmsParams, params);
1206
+ this.wmsParams = Util.extend(
1207
+ {},
1208
+ this.defaultWmsParams,
1209
+ (_a = params == null ? void 0 : params.params) != null ? _a : {}
1210
+ );
1206
1211
  }
1207
1212
  setParams(params) {
1208
1213
  Util.extend(this.wmsParams, params);
@@ -1391,6 +1396,13 @@ class ImageAdapter extends BaseAdapter {
1391
1396
  return this.layer;
1392
1397
  }
1393
1398
  }
1399
+ updateLayer(options) {
1400
+ if (this.layer) {
1401
+ const params = (options == null ? void 0 : options.params) || {};
1402
+ Util.extend(this.layer.wmsParams, params);
1403
+ this.layer.update();
1404
+ }
1405
+ }
1394
1406
  }
1395
1407
  __publicField$1(ImageAdapter, "queue", imageQueue);
1396
1408
 
@@ -1532,13 +1544,12 @@ class TileAdapter extends BaseAdapter {
1532
1544
  }
1533
1545
  }
1534
1546
  }
1535
- updateLayer() {
1547
+ updateLayer(options) {
1536
1548
  if (this.layer) {
1537
1549
  const currentUrl = this.layer._url;
1538
- const timestamp = (/* @__PURE__ */ new Date()).getTime();
1539
- const separator = currentUrl.includes("?") ? "&" : "?";
1540
- const newUrl = currentUrl.replace(/(\?|&)timestamp=\d*/g, "") + separator + `timestamp=${timestamp}`;
1541
- this.layer.setUrl(newUrl);
1550
+ if (options == null ? void 0 : options.params) {
1551
+ this.layer.setUrl(updateUrlParams(currentUrl, options.params));
1552
+ }
1542
1553
  this.layer.redraw();
1543
1554
  }
1544
1555
  }