@@ -187,6 +187,7 @@ export var MapMLLayer = L.Layer.extend({
187187 this
188188 ) ;
189189 }
190+ this . _setLayerElExtent ( ) ;
190191
191192 this . setZIndex ( this . options . zIndex ) ;
192193 this . getPane ( ) . appendChild ( this . _container ) ;
@@ -368,7 +369,31 @@ export var MapMLLayer = L.Layer.extend({
368369 this . _properties . _mapExtents [ i ] . templatedLayer . zoomBounds =
369370 zoomBounds ;
370371 }
371- } else {
372+ } else if ( type === '_staticTileLayer' ) {
373+ if ( this [ type ] . layerBounds ) {
374+ if ( ! bounds ) {
375+ bounds = this [ type ] . layerBounds ;
376+ zoomBounds = this [ type ] . zoomBounds ;
377+ } else {
378+ bounds . extend ( this [ type ] . layerBounds . min ) ;
379+ bounds . extend ( this [ type ] . layerBounds . max ) ;
380+ }
381+ }
382+ } else if ( type === '_imageLayer' ) {
383+ if ( this [ type ] . layerBounds ) {
384+ if ( ! bounds ) {
385+ bounds = this [ type ] . layerBounds ;
386+ zoomBounds = this [ type ] . zoomBounds ;
387+ } else {
388+ bounds . extend ( this [ type ] . layerBounds . min ) ;
389+ bounds . extend ( this [ type ] . layerBounds . max ) ;
390+ }
391+ }
392+ } else if (
393+ // only process extent if mapmlvectors is not empty
394+ type === '_mapmlvectors' &&
395+ Object . keys ( this [ type ] . _layers ) . length !== 0
396+ ) {
372397 if ( this [ type ] . layerBounds ) {
373398 if ( ! bounds ) {
374399 bounds = this [ type ] . layerBounds ;
@@ -385,7 +410,7 @@ export var MapMLLayer = L.Layer.extend({
385410 //assigns the formatted extent object to .extent and spreads the zoom ranges to .extent also
386411 this . _layerEl . extent = Object . assign (
387412 M . _convertAndFormatPCRS ( bounds , this . _properties . crs ) ,
388- { zoom : zoomBounds }
413+ { zoom : zoomBounds , projection : this . _properties . projection }
389414 ) ;
390415 }
391416 } ,
@@ -868,7 +893,6 @@ export var MapMLLayer = L.Layer.extend({
868893 // if layer does not have a parent Element, do not need to set Controls
869894 layer . _layerEl . parentElement . _toggleControls ( ) ;
870895 }
871- layer . _setLayerElExtent ( ) ;
872896 layer . fire ( 'foo' , layer , false ) ;
873897 // local functions
874898 // sets layer._properties.projection. Supposed to replace / simplify
@@ -1529,6 +1553,7 @@ export var MapMLLayer = L.Layer.extend({
15291553 layer . _mapmlTileContainer . appendChild ( tiles ) ;
15301554 layer . _staticTileLayer = M . staticTileLayer ( {
15311555 pane : layer . _container ,
1556+ _leafletLayer : layer ,
15321557 projection : layer . _properties . projection ,
15331558 className : 'mapml-static-tile-layer' ,
15341559 tileContainer : layer . _mapmlTileContainer ,
0 commit comments