Handler.d.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import Eventful from './core/Eventful';
  2. import Displayable from './graphic/Displayable';
  3. import { PainterBase } from './PainterBase';
  4. import { HandlerProxyInterface } from './dom/HandlerProxy';
  5. import { ZRRawEvent, ElementEventName } from './core/types';
  6. import Storage from './Storage';
  7. import Element from './Element';
  8. declare class HoveredResult {
  9. x: number;
  10. y: number;
  11. target: Displayable;
  12. topTarget: Displayable;
  13. constructor(x?: number, y?: number);
  14. }
  15. declare type HandlerName = 'click' | 'dblclick' | 'mousewheel' | 'mouseout' | 'mouseup' | 'mousedown' | 'mousemove' | 'contextmenu';
  16. declare class Handler extends Eventful {
  17. storage: Storage;
  18. painter: PainterBase;
  19. painterRoot: HTMLElement;
  20. proxy: HandlerProxyInterface;
  21. private _hovered;
  22. private _gestureMgr;
  23. private _draggingMgr;
  24. private _pointerSize;
  25. _downEl: Element;
  26. _upEl: Element;
  27. _downPoint: [number, number];
  28. constructor(storage: Storage, painter: PainterBase, proxy: HandlerProxyInterface, painterRoot: HTMLElement, pointerSize: number);
  29. setHandlerProxy(proxy: HandlerProxyInterface): void;
  30. mousemove(event: ZRRawEvent): void;
  31. mouseout(event: ZRRawEvent): void;
  32. resize(): void;
  33. dispatch(eventName: HandlerName, eventArgs?: any): void;
  34. dispose(): void;
  35. setCursorStyle(cursorStyle: string): void;
  36. dispatchToElement(targetInfo: {
  37. target?: Element;
  38. topTarget?: Element;
  39. }, eventName: ElementEventName, event: ZRRawEvent): void;
  40. findHover(x: number, y: number, exclude?: Displayable): HoveredResult;
  41. processGesture(event: ZRRawEvent, stage?: 'start' | 'end' | 'change'): void;
  42. click: (event: ZRRawEvent) => void;
  43. mousedown: (event: ZRRawEvent) => void;
  44. mouseup: (event: ZRRawEvent) => void;
  45. mousewheel: (event: ZRRawEvent) => void;
  46. dblclick: (event: ZRRawEvent) => void;
  47. contextmenu: (event: ZRRawEvent) => void;
  48. }
  49. export default Handler;