view.d.ts 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import { Dom } from '@antv/x6-common';
  2. import { Cell } from '../model';
  3. import { View, Markup, CellView } from '../view';
  4. import { Graph } from '../graph';
  5. export declare class GraphView extends View {
  6. protected readonly graph: Graph;
  7. readonly container: HTMLElement;
  8. readonly background: HTMLDivElement;
  9. readonly grid: HTMLDivElement;
  10. readonly svg: SVGSVGElement;
  11. readonly defs: SVGDefsElement;
  12. readonly viewport: SVGGElement;
  13. readonly primer: SVGGElement;
  14. readonly stage: SVGGElement;
  15. readonly decorator: SVGGElement;
  16. readonly overlay: SVGGElement;
  17. private restore;
  18. /** Graph's `this.container` is from outer, should not dispose */
  19. protected get disposeContainer(): boolean;
  20. protected get options(): import("./options").Options.Definition;
  21. constructor(graph: Graph);
  22. delegateEvents(): this;
  23. /**
  24. * Guard the specified event. If the event is not interesting, it
  25. * returns `true`, otherwise returns `false`.
  26. */
  27. guard(e: Dom.EventObject, view?: CellView | null): any;
  28. protected findView(elem: Element): CellView<Cell<Cell.Properties>, CellView.Options> | null;
  29. protected onDblClick(evt: Dom.DoubleClickEvent): void;
  30. protected onClick(evt: Dom.ClickEvent): void;
  31. protected isPreventDefaultContextMenu(view: CellView | null): boolean;
  32. protected onContextMenu(evt: Dom.ContextMenuEvent): void;
  33. delegateDragEvents(e: Dom.MouseDownEvent, view: CellView | null): void;
  34. getMouseMovedCount(e: Dom.EventObject): number;
  35. protected onMouseDown(evt: Dom.MouseDownEvent): void;
  36. protected onMouseMove(evt: Dom.MouseMoveEvent): void;
  37. protected onMouseUp(e: Dom.MouseUpEvent): void;
  38. protected onMouseOver(evt: Dom.MouseOverEvent): void;
  39. protected onMouseOut(evt: Dom.MouseOutEvent): void;
  40. protected onMouseEnter(evt: Dom.MouseEnterEvent): void;
  41. protected onMouseLeave(evt: Dom.MouseLeaveEvent): void;
  42. protected onMouseWheel(evt: Dom.EventObject): void;
  43. protected onCustomEvent(evt: Dom.MouseDownEvent): void;
  44. protected handleMagnetEvent<T extends Dom.EventObject>(evt: T, handler: (this: Graph, view: CellView, e: T, magnet: Element, x: number, y: number) => void): void;
  45. protected onMagnetMouseDown(e: Dom.MouseDownEvent): void;
  46. protected onMagnetDblClick(e: Dom.DoubleClickEvent): void;
  47. protected onMagnetContextMenu(e: Dom.ContextMenuEvent): void;
  48. protected onLabelMouseDown(evt: Dom.MouseDownEvent): void;
  49. protected onImageDragStart(): boolean;
  50. dispose(): void;
  51. }
  52. export declare namespace GraphView {
  53. type SortType = 'none' | 'approx' | 'exact';
  54. }
  55. export declare namespace GraphView {
  56. const markup: Markup.JSONMarkup[];
  57. function snapshoot(elem: Element): () => void;
  58. }
  59. export declare namespace GraphView {
  60. const events: {
  61. [x: string]: string;
  62. dblclick: string;
  63. contextmenu: string;
  64. touchstart: string;
  65. mousedown: string;
  66. mouseover: string;
  67. mouseout: string;
  68. mouseenter: string;
  69. mouseleave: string;
  70. mousewheel: string;
  71. DOMMouseScroll: string;
  72. };
  73. const documentEvents: {
  74. mousemove: string;
  75. touchmove: string;
  76. mouseup: string;
  77. touchend: string;
  78. touchcancel: string;
  79. };
  80. }