From 46816bd92d248381a145c7a32b9e204dd68491e7 Mon Sep 17 00:00:00 2001 From: Robert Imig Date: Fri, 18 Sep 2015 14:05:27 -0400 Subject: [PATCH] Leaflet: Add LeafletLayersControlEvent --- leaflet/leaflet-tests.ts | 5 +++++ leaflet/leaflet.d.ts | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts index 6bec7e217..830fd9102 100755 --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -148,6 +148,11 @@ map.closePopup(); map.addControl(L.control.attribution({position: 'bottomright'})); map.removeControl(L.control.attribution({ position: 'bottomright' })); +L.control.layers({'Base': layer}).addTo(map); +map.on('baseLayerChange', function(e: L.LeafletLayersControlEvent) { + alert(e.name); +}); + map.latLngToLayerPoint(map.layerPointToLatLng(L.point(0, 0))); map.latLngToContainerPoint(map.containerPointToLatLng(L.point(0, 0))); map.containerPointToLayerPoint(L.point(0, 0)); diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index 56d702485..56db245a3 100755 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -1835,6 +1835,22 @@ declare module L { } } +declare module L { + + export interface LeafletLayersControlEvent extends LeafletEvent { + + /** + * The layer that was added or removed. + */ + layer: ILayer; + + /** + * The name of the layer that was added or removed. + */ + name: string; + } +} + declare module L { export interface LeafletLocationEvent extends LeafletEvent {