mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
add missing panInside method to map and fix removeEventListener's signature
This commit is contained in:
11
types/leaflet/index.d.ts
vendored
11
types/leaflet/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Leaflet.js 1.2
|
||||
// Type definitions for Leaflet.js 1.4
|
||||
// Project: https://github.com/Leaflet/Leaflet
|
||||
// Definitions by: Alejandro Sánchez <https://github.com/alejo90>
|
||||
// Arne Schubert <https://github.com/atd-schubert>
|
||||
@@ -323,7 +323,7 @@ export abstract class Evented extends Class {
|
||||
* Note that if you passed a custom context to on, you must pass the same context
|
||||
* to off in order to remove the listener.
|
||||
*/
|
||||
removeEventListener(type: string, fn: LeafletEventHandlerFn, context?: any): this;
|
||||
removeEventListener(type: string, fn?: LeafletEventHandlerFn, context?: any): this;
|
||||
|
||||
/**
|
||||
* Alias for off(...)
|
||||
@@ -1181,6 +1181,12 @@ export interface FitBoundsOptions extends ZoomOptions, PanOptions {
|
||||
maxZoom?: number;
|
||||
}
|
||||
|
||||
export interface PanInsideOptions {
|
||||
paddingTopLeft?: PointExpression;
|
||||
paddingBottomRight?: PointExpression;
|
||||
padding?: PointExpression;
|
||||
}
|
||||
|
||||
export interface LocateOptions {
|
||||
watch?: boolean;
|
||||
setView?: boolean;
|
||||
@@ -1355,6 +1361,7 @@ export class Map extends Evented {
|
||||
setMaxBounds(bounds: LatLngBoundsExpression): this;
|
||||
setMinZoom(zoom: number): this;
|
||||
setMaxZoom(zoom: number): this;
|
||||
panInside(latLng: LatLngExpression, options?: PanInsideOptions): this;
|
||||
panInsideBounds(bounds: LatLngBoundsExpression, options?: PanOptions): this;
|
||||
/**
|
||||
* Boolean for animate or advanced ZoomPanOptions
|
||||
|
||||
@@ -40,8 +40,8 @@ point = new L.Point(12, 13);
|
||||
point = new L.Point(12, 13, true);
|
||||
|
||||
let distance: number;
|
||||
point.distanceTo(point);
|
||||
point.distanceTo(pointTuple);
|
||||
distance = point.distanceTo(point);
|
||||
distance = point.distanceTo(pointTuple);
|
||||
|
||||
const transformation = new L.Transformation(1, 2, 3, 4);
|
||||
point = transformation.transform(point);
|
||||
@@ -163,6 +163,16 @@ map = new L.Map(htmlElement, mapOptions);
|
||||
let doesItHaveLayer: boolean;
|
||||
doesItHaveLayer = map.hasLayer(L.tileLayer(''));
|
||||
|
||||
map.off('moveend');
|
||||
map.off('moveend', () => {});
|
||||
map.off('moveend', () => {}, {});
|
||||
|
||||
map.removeEventListener('moveend');
|
||||
map.removeEventListener('moveend', () => {});
|
||||
map.removeEventListener('moveend', () => {}, {});
|
||||
|
||||
map.panInside(latLng, {padding: [50, 50], paddingBottomRight: point, paddingTopLeft: [100, 100]});
|
||||
|
||||
// map.getRenderer
|
||||
|
||||
let html: HTMLElement;
|
||||
|
||||
Reference in New Issue
Block a user