diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 22f71a9187..f99f76817d 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -494,7 +494,7 @@ export interface TileLayerOptions extends GridLayerOptions { tms?: boolean; zoomReverse?: boolean; detectRetina?: boolean; - crossOrigin?: boolean; + crossOrigin?: CrossOrigin; // [name: string]: any; // You are able add additional properties, but it makes this interface unchackable. // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/15313 @@ -550,12 +550,16 @@ export namespace tileLayer { function wms(baseUrl: string, options?: WMSOptions): TileLayer.WMS; } +export type CrossOrigin = boolean | string; + export interface ImageOverlayOptions extends InteractiveLayerOptions { opacity?: number; alt?: string; interactive?: boolean; attribution?: string; - crossOrigin?: boolean; + crossOrigin?: CrossOrigin; + errorOverlayUrl?: string; + zIndex?: number; className?: string; } @@ -569,6 +573,9 @@ export class ImageOverlay extends Layer { /** Update the bounds that this ImageOverlay covers */ setBounds(bounds: LatLngBounds): this; + /** Changes the zIndex of the image overlay */ + setZIndex(value: number): this; + /** Get the bounds that this ImageOverlay covers */ getBounds(): LatLngBounds; diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts index 8b024d790e..2e0f139e9d 100644 --- a/types/leaflet/leaflet-tests.ts +++ b/types/leaflet/leaflet-tests.ts @@ -263,13 +263,15 @@ imageOverlayOptions = { alt: 'alt', interactive: true, attribution: 'attribution', + errorOverlayUrl: 'http://www.test.com/error.png', + zIndex: 1, crossOrigin: true, className: 'className', bubblingMouseEvents: false, pane: 'pane' }; -const imageOverlayBounds = latLngBounds; +let imageOverlayBounds = latLngBounds; let imageOverlay: L.ImageOverlay; imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds); imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds, imageOverlayOptions); @@ -278,6 +280,14 @@ imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/ alt: 'alt', className: 'className', }); +imageOverlay.setOpacity(100); +imageOverlay.bringToFront(); +imageOverlay.bringToBack(); +imageOverlay.setUrl('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png'); +imageOverlay.setBounds(imageOverlayBounds); +imageOverlay.setZIndex(1); +imageOverlayBounds = imageOverlay.getBounds(); +html = imageOverlay.getElement(); // videoOverlay let videoOverlayOptions: L.VideoOverlayOptions;