Skip to content

Commit 57d3ecf

Browse files
committed
Update how map-feature / mapmlvectors calculates FeatureLayer.layerBounds
1 parent f260153 commit 57d3ecf

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/mapml/layers/FeatureLayer.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ export var FeatureLayer = L.FeatureGroup.extend({
4747
this._staticFeature = true;
4848
this.isVisible = true; //placeholder for when this actually gets updated in the future
4949
this.zoomBounds = M.getZoomBounds(mapml, native.zoom);
50-
this.layerBounds = M.getLayerBounds(mapml);
50+
this.layerBounds = M.getBounds(mapml);
5151
L.extend(this.options, this.zoomBounds);
5252
}
5353
this.addData(mapml, native.cs, native.zoom);
5454
} else if (!mapml) {
5555
this.isVisible = false;
56-
this.layerBounds = this.options.extent;
56+
this.layerBounds = null;
5757
this.zoomBounds = this.options.zoomBounds;
5858
}
5959
},
@@ -273,6 +273,14 @@ export var FeatureLayer = L.FeatureGroup.extend({
273273
}
274274

275275
let layer = this.geometryToLayer(mapml, options, nativeCS, +zoom, title);
276+
let ext = mapml.extent,
277+
xmin = ext.topLeft.pcrs.horizontal,
278+
ymin = ext.bottomRight.pcrs.vertical,
279+
xmax = ext.bottomRight.pcrs.horizontal,
280+
ymax = ext.topLeft.pcrs.vertical,
281+
bnd = L.bounds(L.point(xmin, ymin), L.point(xmax, ymax));
282+
283+
this.layerBounds = this.layerBounds ? this.layerBounds.extend(bnd) : bnd;
276284
if (layer) {
277285
// if the layer is being used as a query handler output, it will have
278286
// a color option set. Otherwise, copy classes from the feature

src/mapml/layers/MapMLLayer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,6 @@ export var MapMLLayer = L.Layer.extend({
15151515
pane: layer._container,
15161516
opacity: layer.options.opacity,
15171517
projection: layer._properties.projection,
1518-
extent: M.getBounds(layer._content),
15191518
native: native,
15201519
zoomBounds: M.getZoomBounds(layer._content, native.zoom),
15211520
// each owned child layer gets a reference to the root layer

0 commit comments

Comments
 (0)