leaflet: Update marker classes to accept both Icon and DivIcon

This commit is contained in:
Christopher Currens
2017-02-20 17:54:09 -08:00
parent 968eacf484
commit 46ceddceff
2 changed files with 12 additions and 2 deletions

4
leaflet/index.d.ts vendored
View File

@@ -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;

View File

@@ -447,3 +447,13 @@ L.marker([1, 2], {
iconUrl: 'my-icon.png'
})
}).bindPopup('<p>Hi</p>');
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'
}));;