scheduler.d.ts 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import { KeyValue, Disposable } from '@antv/x6-common';
  2. import { Rectangle } from '@antv/x6-geometry';
  3. import { Model, Cell } from '../model';
  4. import { View, CellView, EdgeView } from '../view';
  5. import { JOB_PRIORITY } from './queueJob';
  6. import { Graph } from '../graph';
  7. export declare class Scheduler extends Disposable {
  8. views: KeyValue<Scheduler.View>;
  9. willRemoveViews: KeyValue<Scheduler.View>;
  10. protected zPivots: KeyValue<Comment>;
  11. private graph;
  12. private renderArea?;
  13. private queue;
  14. get model(): Model;
  15. get container(): SVGGElement;
  16. constructor(graph: Graph);
  17. protected init(): void;
  18. protected startListening(): void;
  19. protected stopListening(): void;
  20. protected onModelReseted({ options }: Model.EventArgs['reseted']): void;
  21. protected onCellAdded({ cell, options }: Model.EventArgs['cell:added']): void;
  22. protected onCellRemoved({ cell }: Model.EventArgs['cell:removed']): void;
  23. protected onCellZIndexChanged({ cell, options, }: Model.EventArgs['cell:change:zIndex']): void;
  24. protected onCellVisibleChanged({ cell, current, }: Model.EventArgs['cell:change:visible']): void;
  25. requestViewUpdate(view: CellView, flag: number, options?: any, priority?: JOB_PRIORITY, flush?: boolean): void;
  26. setRenderArea(area?: Rectangle): void;
  27. isViewMounted(view: CellView): boolean;
  28. protected renderViews(cells: Cell[], options?: any): void;
  29. protected renderViewInArea(view: CellView, flag: number, options?: any): void;
  30. protected removeViews(cells: Cell[]): void;
  31. protected flush(): void;
  32. protected flushWaitingViews(): void;
  33. protected updateView(view: View, flag: number, options?: any): number;
  34. protected insertView(view: CellView): void;
  35. protected resetViews(): void;
  36. protected removeView(view: CellView): void;
  37. protected toggleVisible(cell: Cell, visible: boolean): void;
  38. protected addZPivot(zIndex?: number): Comment;
  39. protected removeZPivots(): void;
  40. protected createCellView(cell: Cell): CellView<Cell<Cell.Properties>, CellView.Options> | EdgeView<import("../model").Edge<import("../model").Edge.Properties>, EdgeView.Options> | null;
  41. protected getEffectedEdges(view: CellView): {
  42. id: string;
  43. view: CellView;
  44. flag: number;
  45. }[];
  46. protected isUpdatable(view: CellView): boolean;
  47. protected getRenderPriority(view: CellView): JOB_PRIORITY;
  48. dispose(): void;
  49. }
  50. export declare namespace Scheduler {
  51. const FLAG_INSERT: number;
  52. const FLAG_REMOVE: number;
  53. const FLAG_RENDER: number;
  54. }
  55. export declare namespace Scheduler {
  56. enum ViewState {
  57. CREATED = 0,
  58. MOUNTED = 1,
  59. WAITING = 2
  60. }
  61. interface View {
  62. view: CellView;
  63. flag: number;
  64. options: any;
  65. state: ViewState;
  66. }
  67. interface EventArgs {
  68. 'view:mounted': {
  69. view: CellView;
  70. };
  71. 'view:unmounted': {
  72. view: CellView;
  73. };
  74. 'render:done': null;
  75. }
  76. }