From ebcb52fb25a340a2d5e32c4080083dbcf339ebc3 Mon Sep 17 00:00:00 2001 From: silh Date: Mon, 9 Jul 2018 21:25:33 +0300 Subject: [PATCH] Added support for className option in ImageOverlayOptions. (#27077) ImageOverlayOptions extends InteractiveLayerOptions as described in Leaflet docs. Added bubblingMouseEvents option to InteractiveLayerOptions. --- types/leaflet/index.d.ts | 4 +++- types/leaflet/leaflet-tests.ts | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 89f9625114..47b2ebc515 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -390,6 +390,7 @@ export interface LayerOptions { export interface InteractiveLayerOptions extends LayerOptions { interactive?: boolean; + bubblingMouseEvents?: boolean; } export class Layer extends Evented { @@ -542,12 +543,13 @@ export namespace tileLayer { function wms(baseUrl: string, options?: WMSOptions): TileLayer.WMS; } -export interface ImageOverlayOptions extends LayerOptions { +export interface ImageOverlayOptions extends InteractiveLayerOptions { opacity?: number; alt?: string; interactive?: boolean; attribution?: string; crossOrigin?: boolean; + className?: string; } export class ImageOverlay extends Layer { diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts index a22ab91248..1f6671cc8c 100644 --- a/types/leaflet/leaflet-tests.ts +++ b/types/leaflet/leaflet-tests.ts @@ -251,6 +251,29 @@ tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png'); tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions); tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''}); +// imageOverlay +let imageOverlayOptions: L.ImageOverlayOptions; +imageOverlayOptions = { + opacity: 100, + alt: 'alt', + interactive: true, + attribution: 'attribution', + crossOrigin: true, + className: 'className', + bubblingMouseEvents: false, + pane: 'pane' +}; + +const 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); +imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds, { + opacity: 100, + alt: 'alt', + className: 'className', +}); + const eventHandler = () => {}; const domEvent: Event = {} as Event; L.DomEvent