From 46ceddceffd5a16fc0e38dba98878c7f643e194b Mon Sep 17 00:00:00 2001 From: Christopher Currens Date: Mon, 20 Feb 2017 17:54:09 -0800 Subject: [PATCH] leaflet: Update marker classes to accept both Icon and DivIcon --- leaflet/index.d.ts | 4 ++-- leaflet/leaflet-tests.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/leaflet/index.d.ts b/leaflet/index.d.ts index 717e589877..20052bd30d 100644 --- a/leaflet/index.d.ts +++ b/leaflet/index.d.ts @@ -1466,7 +1466,7 @@ declare namespace L { export function divIcon(options?: DivIconOptions): DivIcon; export interface MarkerOptions extends InteractiveLayerOptions { - icon?: Icon; + icon?: Icon | DivIcon; clickable?: boolean; draggable?: boolean; keyboard?: boolean; @@ -1483,7 +1483,7 @@ declare namespace L { getLatLng(): LatLng; setLatLng(latlng: LatLngExpression): this; setZIndexOffset(offset: number): this; - setIcon(icon: Icon): this; + setIcon(icon: Icon | DivIcon): this; setOpacity(opacity: number): this; getElement(): HTMLElement; diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts index bce7afdab6..a6509170ba 100644 --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -447,3 +447,13 @@ L.marker([1, 2], { iconUrl: 'my-icon.png' }) }).bindPopup('

Hi

'); + +L.marker([1, 2], { + icon: L.divIcon({ + className: 'my-icon-class' + }) +}).setIcon(L.icon({ + iconUrl: 'my-icon.png' +})).setIcon(L.divIcon({ + className: 'my-div-icon' +}));;