mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Merge pull request #32586 from v1zix/v1zix/leaflet-update-imageoverlay-options
[@types/leaflet] Update ImageOverlay options and add setZIndex method
This commit is contained in:
commit
d77c47c753
11
types/leaflet/index.d.ts
vendored
11
types/leaflet/index.d.ts
vendored
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user