@ -33,9 +33,7 @@ export function emitIconChanged(el: HTMLElement, icon: Icon | null | undefined)
// Tracks whether a child registered as a plain layer, popup, or tooltip --
// Tracks whether a child registered as a plain layer, popup, or tooltip --
// used by the controls panel and by cleanup logic.
// used by the controls panel and by cleanup logic.
type ChildEntry = {
type ChildEntry = 'layer' | 'popup' | 'tooltip' ;
type : 'layer' | 'popup' | 'tooltip' ;
} ;
// Builds the event handler for a given parent layer. On each
// Builds the event handler for a given parent layer. On each
// leaflet-register event from a descendant, it checks the Leaflet type:
// leaflet-register event from a descendant, it checks the Leaflet type:
@ -49,15 +47,15 @@ function createChildRegisterHandler(layer: Layer, children: Map<HTMLElement, Chi
if ( obj instanceof Popup ) {
if ( obj instanceof Popup ) {
e . stopPropagation ( ) ;
e . stopPropagation ( ) ;
layer . bindPopup ( obj ) ;
layer . bindPopup ( obj ) ;
children . set ( el , { type : 'popup' } ) ;
children . set ( el , 'popup' ) ;
} else if ( obj instanceof Tooltip ) {
} else if ( obj instanceof Tooltip ) {
e . stopPropagation ( ) ;
e . stopPropagation ( ) ;
layer . bindTooltip ( obj ) ;
layer . bindTooltip ( obj ) ;
children . set ( el , { type : 'tooltip' } ) ;
children . set ( el , 'tooltip' ) ;
} else if ( obj instanceof Layer && 'addLayer' in layer ) {
} else if ( obj instanceof Layer && 'addLayer' in layer ) {
e . stopPropagation ( ) ;
e . stopPropagation ( ) ;
( layer as unknown as LayerGroup ) . addLayer ( obj ) ;
( layer as unknown as LayerGroup ) . addLayer ( obj ) ;
children . set ( el , { type : 'layer' } ) ;
children . set ( el , 'layer' ) ;
}
}
} ;
} ;
}
}