Skip to content

Commit 6e12282

Browse files
committed
remove default zoomBounds and layerBounds for empty mapmlvectors
1 parent 03f0186 commit 6e12282

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/mapml/layers/FeatureLayer.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ export var FeatureLayer = L.FeatureGroup.extend({
5555
this.layerBounds = this.options.layerBounds
5656
? this.options.layerBounds
5757
: null;
58-
this.zoomBounds = this.options.zoomBounds;
58+
this.zoomBounds = this.options.zoomBounds
59+
? this.options.zoomBounds
60+
: null;
5961
}
6062
}
6163
},
@@ -137,9 +139,10 @@ export var FeatureLayer = L.FeatureGroup.extend({
137139

138140
_handleMoveEnd: function () {
139141
let mapZoom = this._map.getZoom(),
140-
withinZoom =
141-
mapZoom <= this.zoomBounds.maxZoom &&
142-
mapZoom >= this.zoomBounds.minZoom;
142+
withinZoom = this.zoomBounds
143+
? mapZoom <= this.zoomBounds.maxZoom &&
144+
mapZoom >= this.zoomBounds.minZoom
145+
: false;
143146
this.isVisible =
144147
withinZoom &&
145148
this._layers &&
@@ -157,8 +160,8 @@ export var FeatureLayer = L.FeatureGroup.extend({
157160
_handleZoomEnd: function (e) {
158161
let mapZoom = this._map.getZoom();
159162
if (
160-
mapZoom > this.zoomBounds.maxZoom ||
161-
mapZoom < this.zoomBounds.minZoom
163+
this.zoomBounds &&
164+
(mapZoom > this.zoomBounds.maxZoom || mapZoom < this.zoomBounds.minZoom)
162165
) {
163166
this.clearLayers();
164167
return;

src/mapml/layers/MapMLLayer.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,12 +1515,10 @@ export var MapMLLayer = L.Layer.extend({
15151515
pane: layer._container,
15161516
opacity: layer.options.opacity,
15171517
projection: layer._properties.projection,
1518-
layerBounds: M.getBounds(layer._content),
15191518
// by NOT passing options.extent, we are asking the FeatureLayer
15201519
// to dynamically update its .layerBounds property as features are
15211520
// added or removed from it
15221521
native: native,
1523-
zoomBounds: M.getZoomBounds(layer._content, native.zoom),
15241522
// each owned child layer gets a reference to the root layer
15251523
_leafletLayer: layer,
15261524
static: true,

0 commit comments

Comments
 (0)