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 {
229229 // todo: dynamically update layer bounds of vector layer
230230 mapmlvectors . layerBounds = M . getBounds ( this . _layer . _content ) ;
231231 // update map's zoom limit
232- // this._map._addZoomLimit(mapmlvectors);
232+ this . _map . _addZoomLimit ( mapmlvectors ) ;
233233 // TODO: can be set as a handler of featureLayer
234234 mapmlvectors . _resetFeatures ( ) ;
235235 L . extend ( mapmlvectors . options , mapmlvectors . zoomBounds ) ;
236236 }
237237 }
238238
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 ) {
240243 this . _layer . _setLayerElExtent ( ) ;
241244 }
242245 this . _setUpEvents ( ) ;
Original file line number Diff line number Diff line change @@ -375,11 +375,7 @@ export var MapMLLayer = L.Layer.extend({
375375 bounds . extend ( this [ type ] . layerBounds . max ) ;
376376 }
377377 }
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' ) {
383379 if ( this [ type ] . layerBounds ) {
384380 if ( ! bounds ) {
385381 bounds = this [ type ] . layerBounds ;
You can’t perform that action at this time.
0 commit comments