@@ -472,16 +472,6 @@ export class BaseLayerElement extends HTMLElement {
472472 * child element processing.
473473 */
474474 _runMutationObserver ( elementsGroup ) {
475- const _addFeatureToMapMLVectors = ( feature ) => {
476- this . whenReady ( ) . then ( ( ) => {
477- // the layer extent must change as features are added, this.extent
478- // property only recalculates the bounds and zoomBounds when .bounds
479- // doesn't exist, so delete it to ensure that the extent is reset
480- delete this . _layer . bounds ;
481- // Features now manage themselves through connectedCallback and MapFeatureLayer
482- // This method now only handles extent recalculation
483- } ) ;
484- } ;
485475 const _addStylesheetLink = ( mapLink ) => {
486476 this . whenReady ( ) . then ( ( ) => {
487477 this . _layer . renderStyles ( mapLink ) ;
@@ -513,9 +503,6 @@ export class BaseLayerElement extends HTMLElement {
513503 for ( let i = 0 ; i < elementsGroup . length ; ++ i ) {
514504 let element = elementsGroup [ i ] ;
515505 switch ( element . nodeName ) {
516- case 'MAP-FEATURE' :
517- _addFeatureToMapMLVectors ( element ) ;
518- break ;
519506 case 'MAP-LINK' :
520507 if ( element . link && ! element . link . isConnected )
521508 _addStylesheetLink ( element ) ;
@@ -598,16 +585,19 @@ export class BaseLayerElement extends HTMLElement {
598585 opacity : window . getComputedStyle ( this ) . opacity
599586 } ) ;
600587 // make sure the Leaflet layer has a reference to the map
601- this . _layer . _map = this . parentNode . _map ;
588+ // this is causing problems with LayerGroup, as Leaflet uses the _map property
589+ // to determine if a LayerGroup's child layers should have their onAdd invoked
590+ // (be added to the map)
591+ // this._layer._map = this.parentNode._map;
602592
603593 if ( this . checked ) {
604- this . _layer . addTo ( this . _layer . _map ) ;
594+ this . _layer . addTo ( this . parentNode . _map ) ;
595+ // toggle the this.disabled attribute depending on whether the layer
596+ // is: same prj as map, within view/zoom of map
605597 }
598+ this . parentNode . _map . on ( 'moveend layeradd' , this . _validateDisabled , this ) ;
606599
607600 this . _layer . on ( 'add remove' , this . _validateDisabled , this ) ;
608- // toggle the this.disabled attribute depending on whether the layer
609- // is: same prj as map, within view/zoom of map
610- this . _layer . _map . on ( 'moveend layeradd' , this . _validateDisabled , this ) ;
611601
612602 if ( this . parentNode . _layerControl )
613603 this . _layerControl = this . parentNode . _layerControl ;
0 commit comments