* Use native mouse event in originalEvent propery

* Added DomUtil declaration
* Added Class declaration (think about generics)
* Evented class inherited from Class
This commit is contained in:
goleon 2016-11-04 00:52:13 +04:00
parent 255ae20ac7
commit 5c443dc6d1

39
leaflet/leaflet.d.ts vendored
View File

@ -5,7 +5,42 @@
/// <reference path="../geojson/geojson.d.ts" />
type NativeMouseEvent = MouseEvent;
declare namespace L {
export class Class {
static extend(props:any):any/* how to return constructor of self extended type ? */;
static include(props:any):any /* how to return self extended type ? */;
static mergeOptions(props:any): any /* how to return self extended type ? */;
static addInitHook(initHookFn: ()=> void): any/* how to return self extended type ? */;
}
export class DomUtil {
static get(id: string|HTMLElement): HTMLElement;
static getStyle(el: HTMLElement, styleAttrib: string): string;
static create(tagName: String, className?: String, container?: HTMLElement): HTMLElement;
static remove(el: HTMLElement):void;
static empty(el: HTMLElement):void;
static toFront(el: HTMLElement):void;
static toBack(el: HTMLElement):void;
static hasClass(el: HTMLElement, name: String): Boolean;
static addClass(el: HTMLElement, name: String):void;
static removeClass(el: HTMLElement, name: String):void;
static setClass(el: HTMLElement, name: String):void;
static getClass(el: HTMLElement): String;
static setOpacity(el: HTMLElement, opacity: Number);
static testProp(props: String[]): String|boolean/*=false*/;
static setTransform(el: HTMLElement, offset: Point, scale?: Number);
static setPosition(el: HTMLElement, position: Point):void;
static getPosition(el: HTMLElement): Point
static disableTextSelection(): void
static enableTextSelection(): void
static disableImageDrag(): void
static enableImageDrag(): void
static preventOutline(el: HTMLElement): void
static restoreOutline(): void
}
export interface CRS {
latLngToPoint(latlng: LatLng, zoom: number): Point;
latLngToPoint(latlng: LatLngLiteral, zoom: number): Point;
@ -211,7 +246,7 @@ declare namespace L {
* with an object (e.g. the user clicks on the map, causing the map to fire
* 'click' event).
*/
export interface Evented {
export interface Evented extends Class {
/**
* Adds a listener function (fn) to a particular event type of the object.
* You can optionally specify the context of the listener (object the this
@ -1125,7 +1160,7 @@ declare namespace L {
latlng: LatLng;
layerPoint: Point;
containerPoint: Point;
originalEvent: MouseEvent; // how can I reference the global MouseEvent?
originalEvent: NativeMouseEvent;
}
export interface LocationEvent extends Event {