Handler.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. _downEl: Element;
  25. _upEl: Element;
  26. _downPoint: [number, number];
  27. constructor(storage: Storage, painter: PainterBase, proxy: HandlerProxyInterface, painterRoot: HTMLElement);
  28. setHandlerProxy(proxy: HandlerProxyInterface): void;
  29. mousemove(event: ZRRawEvent): void;
  30. mouseout(event: ZRRawEvent): void;
  31. resize(): void;
  32. dispatch(eventName: HandlerName, eventArgs?: any): void;
  33. dispose(): void;
  34. setCursorStyle(cursorStyle: string): void;
  35. dispatchToElement(targetInfo: {
  36. target?: Element;
  37. topTarget?: Element;
  38. }, eventName: ElementEventName, event: ZRRawEvent): void;
  39. findHover(x: number, y: number, exclude?: Displayable): HoveredResult;
  40. processGesture(event: ZRRawEvent, stage?: 'start' | 'end' | 'change'): void;
  41. click: (event: ZRRawEvent) => void;
  42. mousedown: (event: ZRRawEvent) => void;
  43. mouseup: (event: ZRRawEvent) => void;
  44. mousewheel: (event: ZRRawEvent) => void;
  45. dblclick: (event: ZRRawEvent) => void;
  46. contextmenu: (event: ZRRawEvent) => void;
  47. }
  48. export default Handler;