@nextgis/leaflet-map-adapter 1.9.4 → 1.11.10

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: 1.9.4; author: NextGIS */
1
+ /** Bundle of @nextgis/leaflet-map-adapter; version: 1.11.10; author: NextGIS */
2
2
  var LeafletMapAdapter = (function () {
3
3
  'use strict';
4
4
 
@@ -94,10 +94,14 @@ var LeafletMapAdapter = (function () {
94
94
  }
95
95
  }
96
96
 
97
- function __spreadArray(to, from) {
98
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
99
- to[j] = from[i];
100
- return to;
97
+ function __spreadArray(to, from, pack) {
98
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
99
+ if (ar || !(i in from)) {
100
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
101
+ ar[i] = from[i];
102
+ }
103
+ }
104
+ return to.concat(ar || Array.prototype.slice.call(from));
101
105
  }
102
106
 
103
107
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -14664,6 +14668,9 @@ var LeafletMapAdapter = (function () {
14664
14668
  if (options.bar) {
14665
14669
  element.classList.add('leaflet-bar');
14666
14670
  }
14671
+ if (options.addClass) {
14672
+ element.classList.add(options.addClass);
14673
+ }
14667
14674
  if (!options.margin && !options.bar) {
14668
14675
  element.style.marginBottom = '0px';
14669
14676
  element.style.marginTop = '0px';
@@ -15867,7 +15874,7 @@ var LeafletMapAdapter = (function () {
15867
15874
  a[_i] = arguments[_i];
15868
15875
  }
15869
15876
  // @ts-ignore
15870
- (_a = leafletSrc.exports.GridLayer.prototype._update).call.apply(_a, __spreadArray([_this], a));
15877
+ (_a = leafletSrc.exports.GridLayer.prototype._update).call.apply(_a, __spreadArray([_this], a, false));
15871
15878
  }, _this.options.setViewDelay);
15872
15879
  }
15873
15880
  return _this;
@@ -16044,6 +16051,7 @@ var LeafletMapAdapter = (function () {
16044
16051
  if (this.map) {
16045
16052
  this.map.remove();
16046
16053
  }
16054
+ this._stopWatchSizeChangeToUpdateMinZoom();
16047
16055
  };
16048
16056
  LeafletMapAdapter.prototype.getContainer = function () {
16049
16057
  return this.map && this.map.getContainer();
@@ -16094,17 +16102,22 @@ var LeafletMapAdapter = (function () {
16094
16102
  }
16095
16103
  if (maxBounds !== undefined) {
16096
16104
  if (maxBounds) {
16097
- map.setMaxBounds(arrayToBoundsExpression(maxBounds));
16105
+ var b = arrayToBoundsExpression(maxBounds);
16106
+ map.setMaxBounds(b);
16107
+ map.setMinZoom(map.getBoundsZoom(b));
16108
+ this._watchSizeChangeToUpdateMinZoom(b);
16098
16109
  }
16099
16110
  else {
16100
16111
  // @ts-ignore `null` works for unset maxBounds, but not in typing
16101
16112
  map.setMaxBounds(null);
16113
+ this._stopWatchSizeChangeToUpdateMinZoom();
16102
16114
  }
16103
16115
  }
16104
16116
  if (maxZoom !== undefined) {
16105
16117
  map.setMaxZoom(maxZoom);
16106
16118
  }
16107
16119
  if (minZoom !== undefined) {
16120
+ this._stopWatchSizeChangeToUpdateMinZoom();
16108
16121
  map.setMinZoom(minZoom);
16109
16122
  }
16110
16123
  }
@@ -16241,6 +16254,27 @@ var LeafletMapAdapter = (function () {
16241
16254
  this._unselectCb.length = 0;
16242
16255
  this._unselectCb.push(cb);
16243
16256
  };
16257
+ LeafletMapAdapter.prototype._watchSizeChangeToUpdateMinZoom = function (bounds) {
16258
+ this._stopWatchSizeChangeToUpdateMinZoom();
16259
+ var container = this.getContainer();
16260
+ var map = this.map;
16261
+ if (container && map && window.ResizeObserver) {
16262
+ this._resizeObserver = new ResizeObserver(function () {
16263
+ map.setMinZoom(map.getBoundsZoom(bounds));
16264
+ });
16265
+ this._resizeObserver.observe(container);
16266
+ }
16267
+ };
16268
+ LeafletMapAdapter.prototype._stopWatchSizeChangeToUpdateMinZoom = function () {
16269
+ var map = this.map;
16270
+ if (map) {
16271
+ map.setMinZoom(0);
16272
+ }
16273
+ if (this._resizeObserver) {
16274
+ this._resizeObserver.disconnect();
16275
+ this._resizeObserver = undefined;
16276
+ }
16277
+ };
16244
16278
  LeafletMapAdapter.prototype._addMapListeners = function () {
16245
16279
  var _this = this;
16246
16280
  var map = this.map;