File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -229,14 +229,17 @@ export class MapFeature extends HTMLElement {
229
229
// todo: dynamically update layer bounds of vector layer
230
230
mapmlvectors . layerBounds = M . getBounds ( this . _layer . _content ) ;
231
231
// update map's zoom limit
232
- // this._map._addZoomLimit(mapmlvectors);
232
+ this . _map . _addZoomLimit ( mapmlvectors ) ;
233
233
// TODO: can be set as a handler of featureLayer
234
234
mapmlvectors . _resetFeatures ( ) ;
235
235
L . extend ( mapmlvectors . options , mapmlvectors . zoomBounds ) ;
236
236
}
237
237
}
238
238
239
- if ( Object . keys ( mapmlvectors . _layers ) . length === 1 ) {
239
+ // Number of features that are being displayed on the map
240
+ let renderedFeatureCount = Object . keys ( mapmlvectors . _layers ) . length ;
241
+ // 0 because feature could be hidden by the min/max attr., 1 so as other features are added, _setLayerElExtent() is not run multiple times
242
+ if ( renderedFeatureCount === 1 || renderedFeatureCount === 0 ) {
240
243
this . _layer . _setLayerElExtent ( ) ;
241
244
}
242
245
this . _setUpEvents ( ) ;
Original file line number Diff line number Diff line change @@ -375,11 +375,7 @@ export var MapMLLayer = L.Layer.extend({
375
375
bounds . extend ( this [ type ] . layerBounds . max ) ;
376
376
}
377
377
}
378
- } else if (
379
- // only process extent if mapmlvectors is not empty
380
- type === '_mapmlvectors' &&
381
- Object . keys ( this [ type ] . _layers ) . length !== 0
382
- ) {
378
+ } else if ( type === '_mapmlvectors' ) {
383
379
if ( this [ type ] . layerBounds ) {
384
380
if ( ! bounds ) {
385
381
bounds = this [ type ] . layerBounds ;
You can’t perform that action at this time.
0 commit comments