event.d.ts 1.3 KB

123456789101112131415161718192021222324
  1. import Eventful from './Eventful';
  2. import { ZRRawEvent } from './types';
  3. declare type FirefoxMouseEvent = {
  4. layerX: number;
  5. layerY: number;
  6. };
  7. export declare function clientToLocal(el: HTMLElement, e: ZRRawEvent | FirefoxMouseEvent | Touch, out: {
  8. zrX?: number;
  9. zrY?: number;
  10. }, calculate?: boolean): {
  11. zrX?: number;
  12. zrY?: number;
  13. };
  14. export declare function getNativeEvent(e: ZRRawEvent): ZRRawEvent;
  15. export declare function normalizeEvent(el: HTMLElement, e: ZRRawEvent, calculate?: boolean): ZRRawEvent;
  16. declare type AddEventListenerParams = Parameters<typeof HTMLElement.prototype.addEventListener>;
  17. declare type RemoveEventListenerParams = Parameters<typeof HTMLElement.prototype.removeEventListener>;
  18. export declare function addEventListener(el: HTMLElement | HTMLDocument, name: AddEventListenerParams[0], handler: AddEventListenerParams[1], opt?: AddEventListenerParams[2]): void;
  19. export declare function removeEventListener(el: HTMLElement | HTMLDocument, name: RemoveEventListenerParams[0], handler: RemoveEventListenerParams[1], opt: RemoveEventListenerParams[2]): void;
  20. export declare const stop: (e: MouseEvent | TouchEvent | PointerEvent) => void;
  21. export declare function isMiddleOrRightButtonOnMouseUpDown(e: {
  22. which: number;
  23. }): boolean;
  24. export { Eventful as Dispatcher };