@antv/g6 5.0.0-beta.0 → 5.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g6.min.js +2 -2
- package/esm/api-doc/item.d.ts +2 -0
- package/esm/api-doc/item.js +2 -0
- package/esm/api-doc/item.js.map +1 -1
- package/esm/constant/shape.d.ts +4 -1
- package/esm/constant/shape.js.map +1 -1
- package/esm/index.d.ts +22 -7
- package/esm/index.js +3 -2
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +1 -1
- package/esm/item/combo.js +16 -9
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +20 -3
- package/esm/item/edge.js +99 -43
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +3 -2
- package/esm/item/item.js +21 -11
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +2 -1
- package/esm/item/node.js +33 -16
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +7 -10
- package/esm/runtime/controller/data.js +127 -283
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +1 -0
- package/esm/runtime/controller/item.js +267 -151
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/plugin.js +3 -3
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/graph.d.ts +103 -23
- package/esm/runtime/graph.js +460 -88
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +9 -9
- package/esm/stdlib/behavior/activate-relations.js +8 -8
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.js +1 -2
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/click-select.js +1 -1
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/create-edge.d.ts +57 -0
- package/esm/stdlib/behavior/create-edge.js +207 -0
- package/esm/stdlib/behavior/create-edge.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +2 -1
- package/esm/stdlib/behavior/drag-canvas.js +57 -26
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +2 -2
- package/esm/stdlib/behavior/drag-combo.js +43 -32
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.d.ts +3 -3
- package/esm/stdlib/behavior/drag-node.js +76 -63
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/index.d.ts +3 -0
- package/esm/stdlib/behavior/index.js +3 -0
- package/esm/stdlib/behavior/index.js.map +1 -1
- package/esm/stdlib/behavior/lasso-select.d.ts +1 -1
- package/esm/stdlib/behavior/lasso-select.js +1 -2
- package/esm/stdlib/behavior/lasso-select.js.map +1 -1
- package/esm/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/esm/stdlib/behavior/scroll-canvas.js +266 -0
- package/esm/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/esm/stdlib/behavior/shortcuts-call.d.ts +38 -0
- package/esm/stdlib/behavior/shortcuts-call.js +80 -0
- package/esm/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas.d.ts +2 -1
- package/esm/stdlib/behavior/zoom-canvas.js +55 -24
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/mapNodeSize.d.ts +2 -2
- package/esm/stdlib/data/mapNodeSize.js +2 -2
- package/esm/stdlib/data/mapNodeSize.js.map +1 -1
- package/esm/stdlib/data/transformV4Data.d.ts +2 -2
- package/esm/stdlib/data/transformV4Data.js +2 -2
- package/esm/stdlib/data/transformV4Data.js.map +1 -1
- package/esm/stdlib/data/validateData.d.ts +2 -2
- package/esm/stdlib/data/validateData.js +16 -11
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +16 -6
- package/esm/stdlib/index.js +20 -10
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +96 -6
- package/esm/stdlib/item/edge/base.js +92 -19
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/line.js +5 -2
- package/esm/stdlib/item/edge/line.js.map +1 -1
- package/esm/stdlib/item/edge/polyline.d.ts +3 -2
- package/esm/stdlib/item/edge/polyline.js +3 -3
- package/esm/stdlib/item/edge/polyline.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +90 -16
- package/esm/stdlib/item/node/base.js +91 -41
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.d.ts +24 -0
- package/esm/stdlib/item/node/base3d.js +24 -8
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/diamond.js +1 -1
- package/esm/stdlib/item/node/ellipse.js +2 -2
- package/esm/stdlib/item/node/hexagon.js +12 -5
- package/esm/stdlib/item/node/hexagon.js.map +1 -1
- package/esm/stdlib/item/node/image.d.ts +40 -0
- package/esm/stdlib/item/node/image.js +110 -0
- package/esm/stdlib/item/node/image.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +1 -0
- package/esm/stdlib/item/node/index.js +1 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/plugin/history/combo-command.js +2 -2
- package/esm/stdlib/plugin/history/combo-command.js.map +1 -1
- package/esm/stdlib/plugin/history/index.d.ts +10 -10
- package/esm/stdlib/plugin/history/index.js +14 -14
- package/esm/stdlib/plugin/history/index.js.map +1 -1
- package/esm/stdlib/plugin/history/item-data-command.js +25 -16
- package/esm/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/esm/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.js +3 -6
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/esm/stdlib/plugin/index.d.ts +2 -0
- package/esm/stdlib/plugin/index.js +2 -0
- package/esm/stdlib/plugin/index.js.map +1 -1
- package/esm/stdlib/plugin/legend/index.js +5 -3
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/map/index.d.ts +118 -0
- package/esm/stdlib/plugin/map/index.js +683 -0
- package/esm/stdlib/plugin/map/index.js.map +1 -0
- package/esm/stdlib/plugin/minimap/index.d.ts +5 -1
- package/esm/stdlib/plugin/minimap/index.js +116 -9
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/snapline/index.d.ts +167 -0
- package/esm/stdlib/plugin/snapline/index.js +1063 -0
- package/esm/stdlib/plugin/snapline/index.js.map +1 -0
- package/esm/stdlib/plugin/timebar/index.d.ts +98 -0
- package/esm/stdlib/plugin/timebar/index.js +303 -0
- package/esm/stdlib/plugin/timebar/index.js.map +1 -0
- package/esm/stdlib/plugin/toolbar/index.js +1 -1
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/plugin/types.d.ts +2 -0
- package/esm/stdlib/theme/dark.js +42 -2
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/light.js +4 -4
- package/esm/types/common.d.ts +1 -0
- package/esm/types/event.d.ts +1 -0
- package/esm/types/graph.d.ts +48 -22
- package/esm/types/hook.d.ts +22 -2
- package/esm/types/item.d.ts +6 -0
- package/esm/types/item.js.map +1 -1
- package/esm/types/spec.d.ts +20 -4
- package/esm/types/view.d.ts +5 -0
- package/esm/util/bbox.d.ts +16 -1
- package/esm/util/bbox.js +29 -0
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/canvas.d.ts +2 -2
- package/esm/util/canvas.js +5 -11
- package/esm/util/canvas.js.map +1 -1
- package/esm/util/event.d.ts +3 -1
- package/esm/util/event.js +8 -1
- package/esm/util/event.js.map +1 -1
- package/esm/util/item.d.ts +16 -1
- package/esm/util/item.js +31 -8
- package/esm/util/item.js.map +1 -1
- package/esm/util/layout.d.ts +11 -0
- package/esm/util/layout.js +45 -0
- package/esm/util/layout.js.map +1 -1
- package/esm/util/point.js +9 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/router.d.ts +4 -3
- package/esm/util/router.js +8 -5
- package/esm/util/router.js.map +1 -1
- package/esm/util/shape.d.ts +3 -3
- package/esm/util/shape.js +8 -12
- package/esm/util/shape.js.map +1 -1
- package/esm/util/warn.d.ts +14 -0
- package/esm/util/warn.js +4 -0
- package/esm/util/warn.js.map +1 -0
- package/lib/api-doc/item.d.ts +2 -0
- package/lib/api-doc/item.js +5 -1
- package/lib/api-doc/item.js.map +1 -1
- package/lib/constant/shape.d.ts +4 -1
- package/lib/constant/shape.js.map +1 -1
- package/lib/index.d.ts +22 -7
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +1 -1
- package/lib/item/combo.js +16 -9
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +20 -3
- package/lib/item/edge.js +98 -42
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +3 -2
- package/lib/item/item.js +21 -11
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +2 -1
- package/lib/item/node.js +33 -16
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +7 -10
- package/lib/runtime/controller/data.js +127 -283
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +1 -0
- package/lib/runtime/controller/item.js +266 -150
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/plugin.js +3 -3
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/graph.d.ts +103 -23
- package/lib/runtime/graph.js +460 -88
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +9 -9
- package/lib/stdlib/behavior/activate-relations.js +8 -8
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.js +1 -2
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/click-select.js +1 -1
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/create-edge.d.ts +57 -0
- package/lib/stdlib/behavior/create-edge.js +211 -0
- package/lib/stdlib/behavior/create-edge.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +2 -1
- package/lib/stdlib/behavior/drag-canvas.js +57 -26
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +2 -2
- package/lib/stdlib/behavior/drag-combo.js +43 -32
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.d.ts +3 -3
- package/lib/stdlib/behavior/drag-node.js +76 -63
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/index.d.ts +3 -0
- package/lib/stdlib/behavior/index.js +3 -0
- package/lib/stdlib/behavior/index.js.map +1 -1
- package/lib/stdlib/behavior/lasso-select.d.ts +1 -1
- package/lib/stdlib/behavior/lasso-select.js +1 -2
- package/lib/stdlib/behavior/lasso-select.js.map +1 -1
- package/lib/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/lib/stdlib/behavior/scroll-canvas.js +270 -0
- package/lib/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/lib/stdlib/behavior/shortcuts-call.d.ts +38 -0
- package/lib/stdlib/behavior/shortcuts-call.js +84 -0
- package/lib/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas.d.ts +2 -1
- package/lib/stdlib/behavior/zoom-canvas.js +55 -24
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/mapNodeSize.d.ts +2 -2
- package/lib/stdlib/data/mapNodeSize.js +2 -2
- package/lib/stdlib/data/mapNodeSize.js.map +1 -1
- package/lib/stdlib/data/transformV4Data.d.ts +2 -2
- package/lib/stdlib/data/transformV4Data.js +2 -2
- package/lib/stdlib/data/transformV4Data.js.map +1 -1
- package/lib/stdlib/data/validateData.d.ts +2 -2
- package/lib/stdlib/data/validateData.js +16 -11
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +16 -6
- package/lib/stdlib/index.js +20 -10
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +96 -6
- package/lib/stdlib/item/edge/base.js +92 -19
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/line.js +5 -2
- package/lib/stdlib/item/edge/line.js.map +1 -1
- package/lib/stdlib/item/edge/polyline.d.ts +3 -2
- package/lib/stdlib/item/edge/polyline.js +3 -3
- package/lib/stdlib/item/edge/polyline.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +90 -16
- package/lib/stdlib/item/node/base.js +91 -41
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.d.ts +24 -0
- package/lib/stdlib/item/node/base3d.js +24 -8
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/diamond.js +1 -1
- package/lib/stdlib/item/node/ellipse.js +2 -2
- package/lib/stdlib/item/node/hexagon.js +12 -5
- package/lib/stdlib/item/node/hexagon.js.map +1 -1
- package/lib/stdlib/item/node/image.d.ts +40 -0
- package/lib/stdlib/item/node/image.js +114 -0
- package/lib/stdlib/item/node/image.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +1 -0
- package/lib/stdlib/item/node/index.js +1 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/plugin/history/combo-command.js +2 -2
- package/lib/stdlib/plugin/history/combo-command.js.map +1 -1
- package/lib/stdlib/plugin/history/index.d.ts +10 -10
- package/lib/stdlib/plugin/history/index.js +14 -14
- package/lib/stdlib/plugin/history/index.js.map +1 -1
- package/lib/stdlib/plugin/history/item-data-command.js +25 -16
- package/lib/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/lib/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.js +3 -6
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/lib/stdlib/plugin/index.d.ts +2 -0
- package/lib/stdlib/plugin/index.js +2 -0
- package/lib/stdlib/plugin/index.js.map +1 -1
- package/lib/stdlib/plugin/legend/index.js +5 -3
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/map/index.d.ts +118 -0
- package/lib/stdlib/plugin/map/index.js +687 -0
- package/lib/stdlib/plugin/map/index.js.map +1 -0
- package/lib/stdlib/plugin/minimap/index.d.ts +5 -1
- package/lib/stdlib/plugin/minimap/index.js +116 -9
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/snapline/index.d.ts +167 -0
- package/lib/stdlib/plugin/snapline/index.js +1067 -0
- package/lib/stdlib/plugin/snapline/index.js.map +1 -0
- package/lib/stdlib/plugin/timebar/index.d.ts +98 -0
- package/lib/stdlib/plugin/timebar/index.js +307 -0
- package/lib/stdlib/plugin/timebar/index.js.map +1 -0
- package/lib/stdlib/plugin/toolbar/index.js +1 -1
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/plugin/types.d.ts +2 -0
- package/lib/stdlib/theme/dark.js +42 -2
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/light.js +4 -4
- package/lib/types/common.d.ts +1 -0
- package/lib/types/event.d.ts +1 -0
- package/lib/types/graph.d.ts +48 -22
- package/lib/types/hook.d.ts +22 -2
- package/lib/types/item.d.ts +6 -0
- package/lib/types/item.js.map +1 -1
- package/lib/types/spec.d.ts +20 -4
- package/lib/types/view.d.ts +5 -0
- package/lib/util/bbox.d.ts +16 -1
- package/lib/util/bbox.js +32 -1
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/canvas.d.ts +2 -2
- package/lib/util/canvas.js +5 -11
- package/lib/util/canvas.js.map +1 -1
- package/lib/util/event.d.ts +3 -1
- package/lib/util/event.js +8 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/item.d.ts +16 -1
- package/lib/util/item.js +33 -9
- package/lib/util/item.js.map +1 -1
- package/lib/util/layout.d.ts +11 -0
- package/lib/util/layout.js +47 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/point.js +9 -2
- package/lib/util/point.js.map +1 -1
- package/lib/util/router.d.ts +4 -3
- package/lib/util/router.js +8 -5
- package/lib/util/router.js.map +1 -1
- package/lib/util/shape.d.ts +3 -3
- package/lib/util/shape.js +8 -12
- package/lib/util/shape.js.map +1 -1
- package/lib/util/warn.d.ts +14 -0
- package/lib/util/warn.js +8 -0
- package/lib/util/warn.js.map +1 -0
- package/package.json +10 -10
- package/src/api-doc/item.ts +2 -0
- package/src/constant/shape.ts +2 -1
- package/src/index.ts +4 -2
- package/src/item/combo.ts +14 -9
- package/src/item/edge.ts +131 -57
- package/src/item/item.ts +24 -15
- package/src/item/node.ts +38 -24
- package/src/runtime/controller/data.ts +142 -341
- package/src/runtime/controller/item.ts +236 -72
- package/src/runtime/controller/plugin.ts +15 -3
- package/src/runtime/graph.ts +592 -96
- package/src/stdlib/behavior/activate-relations.ts +8 -8
- package/src/stdlib/behavior/brush-select.ts +4 -2
- package/src/stdlib/behavior/click-select.ts +1 -1
- package/src/stdlib/behavior/create-edge.ts +296 -0
- package/src/stdlib/behavior/drag-canvas.ts +76 -27
- package/src/stdlib/behavior/drag-combo.ts +10 -10
- package/src/stdlib/behavior/drag-node.ts +18 -18
- package/src/stdlib/behavior/index.ts +3 -0
- package/src/stdlib/behavior/lasso-select.ts +5 -3
- package/src/stdlib/behavior/scroll-canvas.ts +348 -0
- package/src/stdlib/behavior/shortcuts-call.ts +120 -0
- package/src/stdlib/behavior/zoom-canvas.ts +72 -25
- package/src/stdlib/data/mapNodeSize.ts +2 -2
- package/src/stdlib/data/transformV4Data.ts +2 -2
- package/src/stdlib/data/validateData.ts +16 -11
- package/src/stdlib/index.ts +33 -9
- package/src/stdlib/item/edge/base.ts +118 -19
- package/src/stdlib/item/edge/line.ts +8 -2
- package/src/stdlib/item/edge/polyline.ts +7 -5
- package/src/stdlib/item/node/base.ts +117 -46
- package/src/stdlib/item/node/base3d.ts +24 -9
- package/src/stdlib/item/node/diamond.ts +1 -1
- package/src/stdlib/item/node/ellipse.ts +2 -2
- package/src/stdlib/item/node/hexagon.ts +14 -6
- package/src/stdlib/item/node/image.ts +190 -0
- package/src/stdlib/item/node/index.ts +1 -0
- package/src/stdlib/plugin/history/combo-command.ts +2 -2
- package/src/stdlib/plugin/history/index.ts +14 -14
- package/src/stdlib/plugin/history/item-data-command.ts +35 -17
- package/src/stdlib/plugin/history/layer-updated-command.ts +2 -2
- package/src/stdlib/plugin/history/state-updated-command.ts +1 -1
- package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
- package/src/stdlib/plugin/hull/hullComponent.ts +8 -5
- package/src/stdlib/plugin/index.ts +2 -0
- package/src/stdlib/plugin/legend/index.ts +5 -4
- package/src/stdlib/plugin/map/index.ts +808 -0
- package/src/stdlib/plugin/minimap/index.ts +120 -10
- package/src/stdlib/plugin/snapline/index.ts +1297 -0
- package/src/stdlib/plugin/timebar/index.ts +473 -0
- package/src/stdlib/plugin/toolbar/index.ts +1 -1
- package/src/stdlib/plugin/types.ts +2 -0
- package/src/stdlib/theme/dark.ts +66 -2
- package/src/stdlib/theme/light.ts +4 -4
- package/src/types/common.ts +1 -0
- package/src/types/event.ts +1 -0
- package/src/types/graph.ts +59 -25
- package/src/types/hook.ts +22 -2
- package/src/types/item.ts +10 -0
- package/src/types/spec.ts +23 -4
- package/src/types/view.ts +8 -3
- package/src/util/bbox.ts +38 -1
- package/src/util/canvas.ts +5 -5
- package/src/util/event.ts +14 -1
- package/src/util/item.ts +65 -28
- package/src/util/layout.ts +45 -0
- package/src/util/point.ts +8 -3
- package/src/util/router.ts +15 -6
- package/src/util/shape.ts +16 -14
- package/src/util/warn.ts +20 -0
- package/src/api-doc/readme.md +0 -59
package/lib/runtime/graph.js
CHANGED
|
@@ -24,9 +24,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const event_emitter_1 = __importDefault(require("@antv/event-emitter"));
|
|
27
|
+
const g_1 = require("@antv/g");
|
|
27
28
|
const util_1 = require("@antv/util");
|
|
29
|
+
const dom_util_1 = require("@antv/dom-util");
|
|
28
30
|
const canvas_1 = require("../util/canvas");
|
|
29
31
|
const shape_1 = require("../util/shape");
|
|
32
|
+
const layout_1 = require("../util/layout");
|
|
30
33
|
const controller_1 = require("./controller");
|
|
31
34
|
const plugin_1 = require("./controller/plugin");
|
|
32
35
|
const hooks_1 = __importDefault(require("./hooks"));
|
|
@@ -44,17 +47,17 @@ class Graph extends event_emitter_1.default {
|
|
|
44
47
|
* Execute a callback without allowing any stacking operations.
|
|
45
48
|
* @param callback
|
|
46
49
|
*/
|
|
47
|
-
this.
|
|
50
|
+
this.executeWithNoStack = (callback) => {
|
|
48
51
|
const history = this.getHistoryPlugin();
|
|
49
|
-
history === null || history === void 0 ? void 0 : history.
|
|
52
|
+
history === null || history === void 0 ? void 0 : history.pauseStack();
|
|
50
53
|
try {
|
|
51
54
|
callback();
|
|
52
55
|
}
|
|
53
56
|
finally {
|
|
54
|
-
history === null || history === void 0 ? void 0 : history.
|
|
57
|
+
history === null || history === void 0 ? void 0 : history.resumeStack();
|
|
55
58
|
}
|
|
56
59
|
};
|
|
57
|
-
this.specification = Object.assign({}, this.defaultSpecification, spec);
|
|
60
|
+
this.specification = Object.assign({}, this.defaultSpecification, this.formatSpecification(spec));
|
|
58
61
|
this.initHooks();
|
|
59
62
|
this.initCanvas();
|
|
60
63
|
this.initControllers();
|
|
@@ -198,16 +201,23 @@ class Graph extends event_emitter_1.default {
|
|
|
198
201
|
}),
|
|
199
202
|
transientupdate: new hooks_1.default({ name: 'transientupdate' }),
|
|
200
203
|
pluginchange: new hooks_1.default({ name: 'pluginchange' }),
|
|
201
|
-
themechange: new hooks_1.default({ name: '
|
|
204
|
+
themechange: new hooks_1.default({ name: 'themechange' }),
|
|
205
|
+
mapperchange: new hooks_1.default({ name: 'mapperchange' }),
|
|
202
206
|
treecollapseexpand: new hooks_1.default({ name: 'treecollapseexpand' }),
|
|
203
207
|
destroy: new hooks_1.default({ name: 'destroy' }),
|
|
204
208
|
};
|
|
205
209
|
}
|
|
210
|
+
formatSpecification(spec) {
|
|
211
|
+
var _a;
|
|
212
|
+
return Object.assign(Object.assign(Object.assign({}, this.specification), spec), { optimize: Object.assign(Object.assign({ tileBehavior: 2000, tileBehaviorSize: 1000, tileFirstRender: 10000, tileFirstRenderSize: 1000 }, (_a = this.specification) === null || _a === void 0 ? void 0 : _a.optimize), spec.optimize) });
|
|
213
|
+
}
|
|
206
214
|
/**
|
|
207
215
|
* Update the specs(configurations).
|
|
208
216
|
*/
|
|
209
217
|
updateSpecification(spec) {
|
|
210
|
-
|
|
218
|
+
const newSpec = Object.assign(this.specification, this.formatSpecification(spec));
|
|
219
|
+
// TODO: update something
|
|
220
|
+
return newSpec;
|
|
211
221
|
}
|
|
212
222
|
/**
|
|
213
223
|
* Update the theme specs (configurations).
|
|
@@ -228,6 +238,28 @@ class Graph extends event_emitter_1.default {
|
|
|
228
238
|
theme: this.themeController.specification,
|
|
229
239
|
});
|
|
230
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Update the item display mapper for a specific item type.
|
|
243
|
+
* @param {ITEM_TYPE} type - The type of item (node, edge, or combo).
|
|
244
|
+
* @param {NodeMapper | EdgeMapper | ComboMapper} mapper - The mapper to be updated.
|
|
245
|
+
* */
|
|
246
|
+
updateMapper(type, mapper) {
|
|
247
|
+
switch (type) {
|
|
248
|
+
case 'node':
|
|
249
|
+
this.specification.node = mapper;
|
|
250
|
+
break;
|
|
251
|
+
case 'edge':
|
|
252
|
+
this.specification.edge = mapper;
|
|
253
|
+
break;
|
|
254
|
+
case 'combo':
|
|
255
|
+
this.specification.combo = mapper;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
this.hooks.mapperchange.emit({
|
|
259
|
+
type,
|
|
260
|
+
mapper,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
231
263
|
/**
|
|
232
264
|
* Get the copy of specs(configurations).
|
|
233
265
|
* @returns graph specs
|
|
@@ -244,30 +276,39 @@ class Graph extends event_emitter_1.default {
|
|
|
244
276
|
*/
|
|
245
277
|
read(data) {
|
|
246
278
|
return __awaiter(this, void 0, void 0, function* () {
|
|
279
|
+
const { tileFirstRender, tileFirstRenderSize } = this.specification.optimize || {};
|
|
247
280
|
this.hooks.datachange.emit({ data, type: 'replace' });
|
|
248
281
|
const emitRender = () => __awaiter(this, void 0, void 0, function* () {
|
|
249
|
-
this.hooks.render.
|
|
282
|
+
yield this.hooks.render.emitLinearAsync({
|
|
250
283
|
graphCore: this.dataController.graphCore,
|
|
251
284
|
theme: this.themeController.specification,
|
|
252
285
|
transientCanvas: this.transientCanvas,
|
|
286
|
+
tileOptimize: {
|
|
287
|
+
tileFirstRender,
|
|
288
|
+
tileFirstRenderSize,
|
|
289
|
+
},
|
|
253
290
|
});
|
|
254
291
|
this.emit('afterrender');
|
|
255
292
|
this.once('afterlayout', () => __awaiter(this, void 0, void 0, function* () {
|
|
256
293
|
const { autoFit } = this.specification;
|
|
257
294
|
if (autoFit) {
|
|
258
295
|
if (autoFit === 'view') {
|
|
259
|
-
yield this.fitView();
|
|
296
|
+
yield this.fitView({ rules: { boundsType: 'layout' } });
|
|
260
297
|
}
|
|
261
298
|
else if (autoFit === 'center') {
|
|
262
|
-
yield this.fitCenter();
|
|
299
|
+
yield this.fitCenter('layout');
|
|
263
300
|
}
|
|
264
301
|
else {
|
|
265
302
|
const { type, effectTiming } = autoFit, others = __rest(autoFit, ["type", "effectTiming"]);
|
|
266
303
|
if (type === 'view') {
|
|
267
|
-
|
|
304
|
+
const { padding, rules } = others;
|
|
305
|
+
yield this.fitView({
|
|
306
|
+
padding,
|
|
307
|
+
rules: Object.assign(Object.assign({}, rules), { boundsType: 'layout' }),
|
|
308
|
+
}, effectTiming);
|
|
268
309
|
}
|
|
269
310
|
else if (type === 'center') {
|
|
270
|
-
yield this.fitCenter(effectTiming);
|
|
311
|
+
yield this.fitCenter('layout', effectTiming);
|
|
271
312
|
}
|
|
272
313
|
else if (type === 'position') {
|
|
273
314
|
// TODO: align
|
|
@@ -296,11 +337,16 @@ class Graph extends event_emitter_1.default {
|
|
|
296
337
|
*/
|
|
297
338
|
changeData(data, type = 'mergeReplace') {
|
|
298
339
|
return __awaiter(this, void 0, void 0, function* () {
|
|
340
|
+
const { tileFirstRender, tileFirstRenderSize } = this.specification.optimize || {};
|
|
299
341
|
this.hooks.datachange.emit({ data, type });
|
|
300
342
|
this.hooks.render.emit({
|
|
301
343
|
graphCore: this.dataController.graphCore,
|
|
302
344
|
theme: this.themeController.specification,
|
|
303
345
|
transientCanvas: this.transientCanvas,
|
|
346
|
+
tileOptimize: {
|
|
347
|
+
tileFirstRender,
|
|
348
|
+
tileFirstRenderSize,
|
|
349
|
+
},
|
|
304
350
|
});
|
|
305
351
|
this.emit('afterrender');
|
|
306
352
|
yield this.layout();
|
|
@@ -311,11 +357,11 @@ class Graph extends event_emitter_1.default {
|
|
|
311
357
|
* @returns
|
|
312
358
|
*/
|
|
313
359
|
clear() {
|
|
314
|
-
this.
|
|
360
|
+
this.startHistoryBatch();
|
|
315
361
|
this.removeData('edge', this.getAllEdgesData().map((edge) => edge.id));
|
|
316
362
|
this.removeData('node', this.getAllNodesData().map((node) => node.id));
|
|
317
363
|
this.removeData('combo', this.getAllCombosData().map((combo) => combo.id));
|
|
318
|
-
this.
|
|
364
|
+
this.stopHistoryBatch();
|
|
319
365
|
}
|
|
320
366
|
getViewportCenter() {
|
|
321
367
|
const { width, height } = this.canvas.getConfig();
|
|
@@ -323,9 +369,11 @@ class Graph extends event_emitter_1.default {
|
|
|
323
369
|
}
|
|
324
370
|
transform(options, effectTiming) {
|
|
325
371
|
return __awaiter(this, void 0, void 0, function* () {
|
|
372
|
+
const { tileLodSize } = this.specification.optimize || {};
|
|
326
373
|
yield this.hooks.viewportchange.emitLinearAsync({
|
|
327
374
|
transform: options,
|
|
328
375
|
effectTiming,
|
|
376
|
+
tileLodSize,
|
|
329
377
|
});
|
|
330
378
|
this.emit('viewportchange', options);
|
|
331
379
|
});
|
|
@@ -433,9 +481,12 @@ class Graph extends event_emitter_1.default {
|
|
|
433
481
|
const [top, right, bottom, left] = padding
|
|
434
482
|
? (0, shape_1.formatPadding)(padding)
|
|
435
483
|
: [0, 0, 0, 0];
|
|
436
|
-
const { direction = 'both', ratioRule = 'min' } = rules || {};
|
|
437
|
-
|
|
438
|
-
|
|
484
|
+
const { direction = 'both', ratioRule = 'min', boundsType = 'render', } = rules || {};
|
|
485
|
+
const { center: [graphCenterX, graphCenterY], halfExtents, } = boundsType === 'render'
|
|
486
|
+
? // Get the bounds of the whole graph content.
|
|
487
|
+
this.canvas.document.documentElement.getBounds()
|
|
488
|
+
: // Get the bounds of the nodes positions while the graph content is not ready.
|
|
489
|
+
(0, layout_1.getLayoutBounds)(this);
|
|
439
490
|
const origin = this.canvas.canvas2Viewport({
|
|
440
491
|
x: graphCenterX,
|
|
441
492
|
y: graphCenterY,
|
|
@@ -480,10 +531,13 @@ class Graph extends event_emitter_1.default {
|
|
|
480
531
|
* Fit the graph center to the view center.
|
|
481
532
|
* @param effectTiming animation configurations
|
|
482
533
|
*/
|
|
483
|
-
fitCenter(effectTiming) {
|
|
534
|
+
fitCenter(boundsType = 'render', effectTiming) {
|
|
484
535
|
return __awaiter(this, void 0, void 0, function* () {
|
|
485
|
-
|
|
486
|
-
|
|
536
|
+
const { center: [graphCenterX, graphCenterY], } = boundsType === 'render'
|
|
537
|
+
? // Get the bounds of the whole graph content.
|
|
538
|
+
this.canvas.document.documentElement.getBounds()
|
|
539
|
+
: // Get the bounds of the nodes positions while the graph content is not ready.
|
|
540
|
+
(0, layout_1.getLayoutBounds)(this);
|
|
487
541
|
yield this.translateTo(this.canvas.canvas2Viewport({ x: graphCenterX, y: graphCenterY }), effectTiming);
|
|
488
542
|
});
|
|
489
543
|
}
|
|
@@ -544,6 +598,25 @@ class Graph extends event_emitter_1.default {
|
|
|
544
598
|
this.specification.height = size[1];
|
|
545
599
|
this.canvas.resize(size[0], size[1]);
|
|
546
600
|
}
|
|
601
|
+
getCanvasRange() {
|
|
602
|
+
const [width, height] = this.getSize();
|
|
603
|
+
const leftTop = this.getCanvasByViewport({ x: 0, y: 0 });
|
|
604
|
+
const rightBottom = this.getCanvasByViewport({ x: width, y: height });
|
|
605
|
+
return {
|
|
606
|
+
min: [leftTop.x, leftTop.y, leftTop.z],
|
|
607
|
+
max: [rightBottom.x, rightBottom.y, rightBottom.z],
|
|
608
|
+
center: [
|
|
609
|
+
(leftTop.x + rightBottom.x) / 2,
|
|
610
|
+
(leftTop.y + rightBottom.y) / 2,
|
|
611
|
+
(leftTop.z + rightBottom.z) / 2,
|
|
612
|
+
],
|
|
613
|
+
halfExtents: [
|
|
614
|
+
(rightBottom.x - leftTop.x) / 2,
|
|
615
|
+
(rightBottom.y - leftTop.y) / 2,
|
|
616
|
+
(rightBottom.z - leftTop.z) / 2,
|
|
617
|
+
],
|
|
618
|
+
};
|
|
619
|
+
}
|
|
547
620
|
/**
|
|
548
621
|
* Get the rendering coordinate according to the canvas dom (viewport) coordinate.
|
|
549
622
|
* @param Point rendering coordinate
|
|
@@ -722,19 +795,21 @@ class Graph extends event_emitter_1.default {
|
|
|
722
795
|
if (!event.changes.length)
|
|
723
796
|
return;
|
|
724
797
|
const changes = event.changes;
|
|
725
|
-
|
|
726
|
-
type: itemType,
|
|
727
|
-
changes: graphCore.reduceChanges(event.changes),
|
|
728
|
-
graphCore,
|
|
729
|
-
theme: specification,
|
|
730
|
-
});
|
|
731
|
-
this.emit('afteritemchange', {
|
|
798
|
+
const timingParameters = {
|
|
732
799
|
type: itemType,
|
|
733
800
|
action: 'add',
|
|
734
801
|
models,
|
|
735
802
|
apiName: 'addData',
|
|
736
803
|
changes,
|
|
804
|
+
};
|
|
805
|
+
this.emit('beforeitemchange', timingParameters);
|
|
806
|
+
this.hooks.itemchange.emit({
|
|
807
|
+
type: itemType,
|
|
808
|
+
changes: graphCore.reduceChanges(event.changes),
|
|
809
|
+
graphCore,
|
|
810
|
+
theme: specification,
|
|
737
811
|
});
|
|
812
|
+
this.emit('afteritemchange', timingParameters);
|
|
738
813
|
});
|
|
739
814
|
const modelArr = (0, util_1.isArray)(models) ? models : [models];
|
|
740
815
|
const data = { nodes: [], edges: [], combos: [] };
|
|
@@ -755,27 +830,38 @@ class Graph extends event_emitter_1.default {
|
|
|
755
830
|
removeData(itemType, ids) {
|
|
756
831
|
const idArr = (0, util_1.isArray)(ids) ? ids : [ids];
|
|
757
832
|
const data = { nodes: [], edges: [], combos: [] };
|
|
758
|
-
const {
|
|
833
|
+
const { graphCore } = this.dataController;
|
|
759
834
|
const { specification } = this.themeController;
|
|
760
|
-
const getItem = itemType === 'edge' ?
|
|
761
|
-
|
|
835
|
+
const getItem = itemType === 'edge' ? graphCore.getEdge : graphCore.getNode;
|
|
836
|
+
const hasItem = itemType === 'edge' ? graphCore.hasEdge : graphCore.hasNode;
|
|
837
|
+
data[`${itemType}s`] = idArr
|
|
838
|
+
.map((id) => {
|
|
839
|
+
if (!hasItem.bind(graphCore)(id)) {
|
|
840
|
+
console.warn(`The ${itemType} data with id ${id} does not exist. It will be ignored`);
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
return getItem.bind(graphCore)(id);
|
|
844
|
+
})
|
|
845
|
+
.filter(Boolean);
|
|
762
846
|
graphCore.once('changed', (event) => {
|
|
763
847
|
if (!event.changes.length)
|
|
764
848
|
return;
|
|
765
849
|
const changes = event.changes;
|
|
766
|
-
|
|
767
|
-
type: itemType,
|
|
768
|
-
changes: event.changes,
|
|
769
|
-
graphCore,
|
|
770
|
-
theme: specification,
|
|
771
|
-
});
|
|
772
|
-
this.emit('afteritemchange', {
|
|
850
|
+
const timingParameters = {
|
|
773
851
|
type: itemType,
|
|
774
852
|
action: 'remove',
|
|
775
853
|
ids: idArr,
|
|
776
854
|
apiName: 'removeData',
|
|
777
855
|
changes,
|
|
856
|
+
};
|
|
857
|
+
this.emit('beforeitemchange', timingParameters);
|
|
858
|
+
this.hooks.itemchange.emit({
|
|
859
|
+
type: itemType,
|
|
860
|
+
changes: event.changes,
|
|
861
|
+
graphCore,
|
|
862
|
+
theme: specification,
|
|
778
863
|
});
|
|
864
|
+
this.emit('afteritemchange', timingParameters);
|
|
779
865
|
});
|
|
780
866
|
this.hooks.datachange.emit({
|
|
781
867
|
data,
|
|
@@ -843,19 +929,21 @@ class Graph extends event_emitter_1.default {
|
|
|
843
929
|
const { specification } = this.themeController;
|
|
844
930
|
graphCore.once('changed', (event) => {
|
|
845
931
|
const changes = this.extendChanges((0, util_1.clone)(event.changes));
|
|
846
|
-
|
|
847
|
-
type: itemType,
|
|
848
|
-
changes: event.changes,
|
|
849
|
-
graphCore,
|
|
850
|
-
theme: specification,
|
|
851
|
-
});
|
|
852
|
-
this.emit('afteritemchange', {
|
|
932
|
+
const timingParameters = {
|
|
853
933
|
type: itemType,
|
|
854
934
|
action: 'update',
|
|
855
935
|
models,
|
|
856
936
|
apiName: 'updateData',
|
|
857
937
|
changes,
|
|
938
|
+
};
|
|
939
|
+
this.emit('beforeitemchange', timingParameters);
|
|
940
|
+
this.hooks.itemchange.emit({
|
|
941
|
+
type: itemType,
|
|
942
|
+
changes: event.changes,
|
|
943
|
+
graphCore,
|
|
944
|
+
theme: specification,
|
|
858
945
|
});
|
|
946
|
+
this.emit('afteritemchange', timingParameters);
|
|
859
947
|
});
|
|
860
948
|
this.hooks.datachange.emit({
|
|
861
949
|
data,
|
|
@@ -902,6 +990,15 @@ class Graph extends event_emitter_1.default {
|
|
|
902
990
|
if (!event.changes.length)
|
|
903
991
|
return;
|
|
904
992
|
const changes = event.changes.filter((change) => !(0, util_1.isEqual)(change.newValue, change.oldValue));
|
|
993
|
+
const timingParameters = {
|
|
994
|
+
type,
|
|
995
|
+
action: 'updatePosition',
|
|
996
|
+
upsertAncestors,
|
|
997
|
+
models,
|
|
998
|
+
apiName: 'updatePosition',
|
|
999
|
+
changes,
|
|
1000
|
+
};
|
|
1001
|
+
this.emit('beforeitemchange', timingParameters);
|
|
905
1002
|
this.hooks.itemchange.emit({
|
|
906
1003
|
type,
|
|
907
1004
|
changes: event.changes,
|
|
@@ -912,14 +1009,7 @@ class Graph extends event_emitter_1.default {
|
|
|
912
1009
|
animate: !disableAnimate,
|
|
913
1010
|
callback,
|
|
914
1011
|
});
|
|
915
|
-
this.emit('afteritemchange',
|
|
916
|
-
type,
|
|
917
|
-
action: 'updatePosition',
|
|
918
|
-
upsertAncestors,
|
|
919
|
-
models,
|
|
920
|
-
apiName: 'updatePosition',
|
|
921
|
-
changes,
|
|
922
|
-
});
|
|
1012
|
+
this.emit('afteritemchange', timingParameters);
|
|
923
1013
|
});
|
|
924
1014
|
this.hooks.datachange.emit({
|
|
925
1015
|
data: {
|
|
@@ -979,7 +1069,7 @@ class Graph extends event_emitter_1.default {
|
|
|
979
1069
|
* @returns
|
|
980
1070
|
* @group Item
|
|
981
1071
|
*/
|
|
982
|
-
hideItem(ids, disableAnimate = false) {
|
|
1072
|
+
hideItem(ids, disableAnimate = false, keepKeyShape = false) {
|
|
983
1073
|
const idArr = (0, util_1.isArray)(ids) ? ids : [ids];
|
|
984
1074
|
if ((0, util_1.isEmpty)(idArr))
|
|
985
1075
|
return;
|
|
@@ -992,6 +1082,7 @@ class Graph extends event_emitter_1.default {
|
|
|
992
1082
|
value: false,
|
|
993
1083
|
graphCore: this.dataController.graphCore,
|
|
994
1084
|
animate: !disableAnimate,
|
|
1085
|
+
keepKeyShape,
|
|
995
1086
|
});
|
|
996
1087
|
this.emit('afteritemvisibilitychange', {
|
|
997
1088
|
ids,
|
|
@@ -999,6 +1090,7 @@ class Graph extends event_emitter_1.default {
|
|
|
999
1090
|
animate: !disableAnimate,
|
|
1000
1091
|
action: 'updateVisibility',
|
|
1001
1092
|
apiName: 'hideItem',
|
|
1093
|
+
keepKeyShape,
|
|
1002
1094
|
changes,
|
|
1003
1095
|
});
|
|
1004
1096
|
}
|
|
@@ -1166,19 +1258,21 @@ class Graph extends event_emitter_1.default {
|
|
|
1166
1258
|
if (!event.changes.length)
|
|
1167
1259
|
return;
|
|
1168
1260
|
const changes = event.changes;
|
|
1169
|
-
|
|
1170
|
-
type: 'combo',
|
|
1171
|
-
changes: graphCore.reduceChanges(event.changes),
|
|
1172
|
-
graphCore,
|
|
1173
|
-
theme: specification,
|
|
1174
|
-
});
|
|
1175
|
-
this.emit('afteritemchange', {
|
|
1261
|
+
const timingParameters = {
|
|
1176
1262
|
type: 'combo',
|
|
1177
1263
|
action: 'add',
|
|
1178
1264
|
models: [model],
|
|
1179
1265
|
apiName: 'addCombo',
|
|
1180
1266
|
changes,
|
|
1267
|
+
};
|
|
1268
|
+
this.emit('beforeitemchange', timingParameters);
|
|
1269
|
+
this.hooks.itemchange.emit({
|
|
1270
|
+
type: 'combo',
|
|
1271
|
+
changes: graphCore.reduceChanges(event.changes),
|
|
1272
|
+
graphCore,
|
|
1273
|
+
theme: specification,
|
|
1181
1274
|
});
|
|
1275
|
+
this.emit('afteritemchange', timingParameters);
|
|
1182
1276
|
});
|
|
1183
1277
|
const data = {
|
|
1184
1278
|
nodes: [],
|
|
@@ -1200,7 +1294,7 @@ class Graph extends event_emitter_1.default {
|
|
|
1200
1294
|
*/
|
|
1201
1295
|
collapseCombo(comboIds) {
|
|
1202
1296
|
const ids = (0, util_1.isArray)(comboIds) ? comboIds : [comboIds];
|
|
1203
|
-
this.
|
|
1297
|
+
this.executeWithNoStack(() => {
|
|
1204
1298
|
this.updateData('combo', ids.map((id) => ({ id, data: { collapsed: true } })));
|
|
1205
1299
|
});
|
|
1206
1300
|
this.emit('aftercollapsecombo', {
|
|
@@ -1217,7 +1311,7 @@ class Graph extends event_emitter_1.default {
|
|
|
1217
1311
|
*/
|
|
1218
1312
|
expandCombo(comboIds) {
|
|
1219
1313
|
const ids = (0, util_1.isArray)(comboIds) ? comboIds : [comboIds];
|
|
1220
|
-
this.
|
|
1314
|
+
this.executeWithNoStack(() => {
|
|
1221
1315
|
this.updateData('combo', ids.map((id) => ({ id, data: { collapsed: false } })));
|
|
1222
1316
|
});
|
|
1223
1317
|
this.emit('afterexpandcombo', {
|
|
@@ -1242,16 +1336,7 @@ class Graph extends event_emitter_1.default {
|
|
|
1242
1336
|
if (!event.changes.length)
|
|
1243
1337
|
return;
|
|
1244
1338
|
const changes = this.extendChanges((0, util_1.clone)(event.changes));
|
|
1245
|
-
|
|
1246
|
-
type: 'combo',
|
|
1247
|
-
changes: event.changes,
|
|
1248
|
-
graphCore,
|
|
1249
|
-
theme: specification,
|
|
1250
|
-
upsertAncestors,
|
|
1251
|
-
action: 'updatePosition',
|
|
1252
|
-
callback,
|
|
1253
|
-
});
|
|
1254
|
-
this.emit('afteritemchange', {
|
|
1339
|
+
const timingParameters = {
|
|
1255
1340
|
type: 'combo',
|
|
1256
1341
|
ids: idArr,
|
|
1257
1342
|
dx,
|
|
@@ -1260,7 +1345,18 @@ class Graph extends event_emitter_1.default {
|
|
|
1260
1345
|
upsertAncestors,
|
|
1261
1346
|
apiName: 'moveCombo',
|
|
1262
1347
|
changes,
|
|
1348
|
+
};
|
|
1349
|
+
this.emit('beforeitemchange', timingParameters);
|
|
1350
|
+
this.hooks.itemchange.emit({
|
|
1351
|
+
type: 'combo',
|
|
1352
|
+
changes: event.changes,
|
|
1353
|
+
graphCore,
|
|
1354
|
+
theme: specification,
|
|
1355
|
+
upsertAncestors,
|
|
1356
|
+
action: 'updatePosition',
|
|
1357
|
+
callback,
|
|
1263
1358
|
});
|
|
1359
|
+
this.emit('afteritemchange', timingParameters);
|
|
1264
1360
|
});
|
|
1265
1361
|
this.hooks.datachange.emit({
|
|
1266
1362
|
data: {
|
|
@@ -1345,6 +1441,14 @@ class Graph extends event_emitter_1.default {
|
|
|
1345
1441
|
getMode() {
|
|
1346
1442
|
return this.interactionController.getMode();
|
|
1347
1443
|
}
|
|
1444
|
+
/**
|
|
1445
|
+
* Set the cursor. But the cursor in item's style has higher priority.
|
|
1446
|
+
* @param cursor
|
|
1447
|
+
*/
|
|
1448
|
+
setCursor(cursor) {
|
|
1449
|
+
this.canvas.setCursor(cursor);
|
|
1450
|
+
this.transientCanvas.setCursor(cursor);
|
|
1451
|
+
}
|
|
1348
1452
|
/**
|
|
1349
1453
|
* Add behavior(s) to mode(s).
|
|
1350
1454
|
* @param behaviors behavior names or configs
|
|
@@ -1515,6 +1619,274 @@ class Graph extends event_emitter_1.default {
|
|
|
1515
1619
|
});
|
|
1516
1620
|
return this.itemController.getTransient(String(id));
|
|
1517
1621
|
}
|
|
1622
|
+
// ===== download operations =====
|
|
1623
|
+
/**
|
|
1624
|
+
* Asynchronously generates a Data URL representation of the canvas content, including
|
|
1625
|
+
* background, main content, and transient canvas.
|
|
1626
|
+
* @param The type of the Data URL (e.g., 'image/png', 'image/jpeg').
|
|
1627
|
+
* @returns A Promise that resolves to the Data URL string.
|
|
1628
|
+
*/
|
|
1629
|
+
toDataURL(type) {
|
|
1630
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1631
|
+
const backgroundCanvas = this.backgroundCanvas;
|
|
1632
|
+
const canvas = this.canvas;
|
|
1633
|
+
const transientCanvas = this.transientCanvas;
|
|
1634
|
+
const rendererType = this.rendererType;
|
|
1635
|
+
const pixelRatio = typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
1636
|
+
const width = this.getSize()[0];
|
|
1637
|
+
const height = this.getSize()[1];
|
|
1638
|
+
const vContainerDOM = (0, dom_util_1.createDom)('<div id="virtual-image"></div>');
|
|
1639
|
+
const vCanvas = (0, canvas_1.createCanvas)(rendererType, vContainerDOM, width, height, pixelRatio);
|
|
1640
|
+
const vCanvasContextService = vCanvas.getContextService();
|
|
1641
|
+
let bgRect;
|
|
1642
|
+
if (rendererType !== 'svg') {
|
|
1643
|
+
bgRect = new g_1.Rect({
|
|
1644
|
+
style: {
|
|
1645
|
+
x: 0,
|
|
1646
|
+
y: 0,
|
|
1647
|
+
z: -1,
|
|
1648
|
+
width: vCanvasContextService.getDomElement().width,
|
|
1649
|
+
height: vCanvasContextService.getDomElement().height,
|
|
1650
|
+
//@ts-ignore
|
|
1651
|
+
fill: backgroundCanvas.getContextService().getDomElement().style['background-color'],
|
|
1652
|
+
},
|
|
1653
|
+
});
|
|
1654
|
+
vCanvas.appendChild(bgRect);
|
|
1655
|
+
}
|
|
1656
|
+
const backgroundClonedGroup = backgroundCanvas.getRoot().cloneNode(true);
|
|
1657
|
+
const clonedGroup = canvas.getRoot().cloneNode(true);
|
|
1658
|
+
const transientClonedGroup = transientCanvas.getRoot().cloneNode(true);
|
|
1659
|
+
vCanvas.appendChild(backgroundClonedGroup);
|
|
1660
|
+
vCanvas.appendChild(clonedGroup);
|
|
1661
|
+
vCanvas.appendChild(transientClonedGroup);
|
|
1662
|
+
vCanvas.render();
|
|
1663
|
+
if (!type)
|
|
1664
|
+
type = 'image/png';
|
|
1665
|
+
let dataURL = '';
|
|
1666
|
+
yield vCanvasContextService.toDataURL({ type }).then((url) => {
|
|
1667
|
+
dataURL = url;
|
|
1668
|
+
});
|
|
1669
|
+
return dataURL;
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Asynchronously generates a Data URL representation of the full canvas content,
|
|
1674
|
+
* including background, main content, and transient canvas, with optional padding.
|
|
1675
|
+
* @param type The type of the Data URL (e.g., 'image/png', 'image/jpeg').
|
|
1676
|
+
* @param imageConfig Configuration options for the image (optional).
|
|
1677
|
+
* @returns A Promise that resolves to the Data URL string.
|
|
1678
|
+
*/
|
|
1679
|
+
toFullDataURL(type, imageConfig) {
|
|
1680
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1681
|
+
const backgroundCanvas = this.backgroundCanvas;
|
|
1682
|
+
const canvas = this.canvas;
|
|
1683
|
+
const transientCanvas = this.transientCanvas;
|
|
1684
|
+
const backgroundRoot = canvas.getRoot();
|
|
1685
|
+
const root = canvas.getRoot();
|
|
1686
|
+
const transientRoot = transientCanvas.getRoot();
|
|
1687
|
+
const rendererType = this.rendererType;
|
|
1688
|
+
const backgroundBBox = backgroundRoot.getBBox();
|
|
1689
|
+
const BBox = root.getBBox();
|
|
1690
|
+
const transientBBox = transientRoot.getBBox();
|
|
1691
|
+
let padding = imageConfig ? imageConfig.padding : undefined;
|
|
1692
|
+
if (!padding) {
|
|
1693
|
+
padding = [0, 0, 0, 0];
|
|
1694
|
+
}
|
|
1695
|
+
else if ((0, util_1.isNumber)(padding)) {
|
|
1696
|
+
padding = [padding, padding, padding, padding];
|
|
1697
|
+
}
|
|
1698
|
+
const left = (transientBBox.left
|
|
1699
|
+
? backgroundBBox.left
|
|
1700
|
+
? Math.min(backgroundBBox.left, BBox.left, transientBBox.left)
|
|
1701
|
+
: Math.min(BBox.left, transientBBox.left)
|
|
1702
|
+
: BBox.left) - padding[3];
|
|
1703
|
+
const right = (transientBBox.right
|
|
1704
|
+
? backgroundBBox.right
|
|
1705
|
+
? Math.max(backgroundBBox.right, BBox.right, transientBBox.right)
|
|
1706
|
+
: Math.max(BBox.right, transientBBox.right)
|
|
1707
|
+
: BBox.right) + padding[1];
|
|
1708
|
+
const top = (transientBBox.top
|
|
1709
|
+
? backgroundBBox.top
|
|
1710
|
+
? Math.min(backgroundBBox.top, BBox.top, transientBBox.top)
|
|
1711
|
+
: Math.min(BBox.top, transientBBox.top)
|
|
1712
|
+
: BBox.top) - padding[0];
|
|
1713
|
+
const bottom = (transientBBox.bottom
|
|
1714
|
+
? backgroundBBox.bottom
|
|
1715
|
+
? Math.max(backgroundBBox.bottom, BBox.bottom, transientBBox.bottom)
|
|
1716
|
+
: Math.max(BBox.bottom, transientBBox.bottom)
|
|
1717
|
+
: BBox.bottom) + padding[2];
|
|
1718
|
+
const graphCenterX = (left + right) / 2;
|
|
1719
|
+
const graphCenterY = (top + bottom) / 2;
|
|
1720
|
+
const halfX = (right - left) / 2;
|
|
1721
|
+
const halfY = (bottom - top) / 2;
|
|
1722
|
+
const pixelRatio = typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
1723
|
+
const vWidth = halfX * 2;
|
|
1724
|
+
const vHeight = halfY * 2;
|
|
1725
|
+
const vContainerDOM = (0, dom_util_1.createDom)('<div id="virtual-image"></div>');
|
|
1726
|
+
const vCanvas = (0, canvas_1.createCanvas)(rendererType, vContainerDOM, vWidth, vHeight, pixelRatio);
|
|
1727
|
+
const vCanvasContextService = vCanvas.getContextService();
|
|
1728
|
+
if (rendererType !== 'svg') {
|
|
1729
|
+
const bgRect = new g_1.Rect({
|
|
1730
|
+
style: {
|
|
1731
|
+
x: 0,
|
|
1732
|
+
y: 0,
|
|
1733
|
+
z: -1,
|
|
1734
|
+
width: vCanvasContextService.getDomElement().width,
|
|
1735
|
+
height: vCanvasContextService.getDomElement().height,
|
|
1736
|
+
//@ts-ignore
|
|
1737
|
+
fill: backgroundCanvas.getContextService().getDomElement().style['background-color'],
|
|
1738
|
+
},
|
|
1739
|
+
});
|
|
1740
|
+
vCanvas.appendChild(bgRect);
|
|
1741
|
+
}
|
|
1742
|
+
const backgroundClonedGroup = backgroundRoot.cloneNode(true);
|
|
1743
|
+
const clonedGroup = root.cloneNode(true);
|
|
1744
|
+
const transientClonedGroup = transientRoot.cloneNode(true);
|
|
1745
|
+
const transPosition = [
|
|
1746
|
+
-graphCenterX + halfX,
|
|
1747
|
+
-graphCenterY + halfY,
|
|
1748
|
+
];
|
|
1749
|
+
backgroundClonedGroup.setPosition(transPosition);
|
|
1750
|
+
clonedGroup.setPosition(transPosition);
|
|
1751
|
+
transientClonedGroup.setPosition(transPosition);
|
|
1752
|
+
vCanvas.appendChild(backgroundClonedGroup);
|
|
1753
|
+
vCanvas.appendChild(clonedGroup);
|
|
1754
|
+
vCanvas.appendChild(transientClonedGroup);
|
|
1755
|
+
vCanvas.render();
|
|
1756
|
+
if (!type)
|
|
1757
|
+
type = 'image/png';
|
|
1758
|
+
let dataURL = '';
|
|
1759
|
+
yield vCanvasContextService.toDataURL({ type }).then((url) => {
|
|
1760
|
+
dataURL = url;
|
|
1761
|
+
});
|
|
1762
|
+
return dataURL;
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Converts a Data URL to an image file and handles the download of the image.
|
|
1767
|
+
* @param dataURL The Data URL of the image to be converted and downloaded.
|
|
1768
|
+
* @param renderer The renderer type ('svg' or other) used for the canvas.
|
|
1769
|
+
* @param link The HTML link element used for image download.
|
|
1770
|
+
* @param fileName The desired name for the downloaded image file.
|
|
1771
|
+
*/
|
|
1772
|
+
dataURLToImage(dataURL, renderer, link, fileName) {
|
|
1773
|
+
if (!dataURL || dataURL === 'data:') {
|
|
1774
|
+
console.error('Download image failed. The graph is too large or there is invalid attribute values in graph items');
|
|
1775
|
+
return;
|
|
1776
|
+
}
|
|
1777
|
+
if (typeof window !== 'undefined') {
|
|
1778
|
+
if (window.Blob && window.URL && renderer !== 'svg') {
|
|
1779
|
+
const arr = dataURL.split(',');
|
|
1780
|
+
let mime = '';
|
|
1781
|
+
if (arr && arr.length > 0) {
|
|
1782
|
+
const match = arr[0].match(/:(.*?);/);
|
|
1783
|
+
// eslint-disable-next-line prefer-destructuring
|
|
1784
|
+
if (match && match.length >= 2)
|
|
1785
|
+
mime = match[1];
|
|
1786
|
+
}
|
|
1787
|
+
const bstr = atob(arr[1]);
|
|
1788
|
+
let n = bstr.length;
|
|
1789
|
+
const u8arr = new Uint8Array(n);
|
|
1790
|
+
while (n--) {
|
|
1791
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
1792
|
+
}
|
|
1793
|
+
const blobObj = new Blob([u8arr], { type: mime });
|
|
1794
|
+
if (window.navigator.msSaveBlob) {
|
|
1795
|
+
window.navigator.msSaveBlob(blobObj, fileName);
|
|
1796
|
+
}
|
|
1797
|
+
else {
|
|
1798
|
+
link.addEventListener('click', () => {
|
|
1799
|
+
link.download = fileName;
|
|
1800
|
+
link.href = window.URL.createObjectURL(blobObj);
|
|
1801
|
+
});
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
else {
|
|
1805
|
+
link.addEventListener('click', () => {
|
|
1806
|
+
link.download = fileName;
|
|
1807
|
+
link.href = dataURL;
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Initiates the download of the graph as an image with an optional name and type.
|
|
1814
|
+
* @param name The desired name for the downloaded image file (optional).
|
|
1815
|
+
* @param type The type of the image to download (optional, defaults to 'image/png').
|
|
1816
|
+
*/
|
|
1817
|
+
downloadImage(name, type) {
|
|
1818
|
+
const self = this;
|
|
1819
|
+
// self.stopAnimate();
|
|
1820
|
+
const rendererType = this.rendererType;
|
|
1821
|
+
if (!type)
|
|
1822
|
+
type = 'image/png';
|
|
1823
|
+
const fileName = (name || 'graph') +
|
|
1824
|
+
(rendererType === 'svg' ? '.svg' : type.split('/')[1]);
|
|
1825
|
+
const link = document.createElement('a');
|
|
1826
|
+
self.asyncToDataUrl(type, (dataURL) => {
|
|
1827
|
+
this.dataURLToImage(dataURL, rendererType, link, fileName);
|
|
1828
|
+
const e = document.createEvent('MouseEvents');
|
|
1829
|
+
e.initEvent('click', false, false);
|
|
1830
|
+
link.dispatchEvent(e);
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* Initiates the download of the entire graph as an image with optional name, type, and padding configuration.
|
|
1835
|
+
* @param name The desired name for the downloaded image file (optional).
|
|
1836
|
+
* @param type The type of the image to download (optional, defaults to 'image/png').
|
|
1837
|
+
* @param imageConfig Configuration options for the image (optional).
|
|
1838
|
+
*/
|
|
1839
|
+
downloadFullImage(name, type, imageConfig) {
|
|
1840
|
+
const self = this;
|
|
1841
|
+
const rendererType = this.rendererType;
|
|
1842
|
+
if (!type)
|
|
1843
|
+
type = 'image/png';
|
|
1844
|
+
const fileName = (name || 'graph') +
|
|
1845
|
+
(rendererType === 'svg' ? '.svg' : type.split('/')[1]);
|
|
1846
|
+
const link = document.createElement('a');
|
|
1847
|
+
self.asyncToFullDataUrl(type, imageConfig, (dataURL) => {
|
|
1848
|
+
this.dataURLToImage(dataURL, rendererType, link, fileName);
|
|
1849
|
+
const e = document.createEvent('MouseEvents');
|
|
1850
|
+
e.initEvent('click', false, false);
|
|
1851
|
+
link.dispatchEvent(e);
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
/**
|
|
1855
|
+
* Asynchronously converts the canvas content to a Data URL of the specified type and invokes the provided callback.
|
|
1856
|
+
* @param type The type of the Data URL (optional, defaults to 'image/png').
|
|
1857
|
+
* @param callback A callback function to handle the Data URL (optional).
|
|
1858
|
+
*/
|
|
1859
|
+
asyncToDataUrl(type, callback) {
|
|
1860
|
+
let dataURL = '';
|
|
1861
|
+
if (!type)
|
|
1862
|
+
type = 'image/png';
|
|
1863
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
1864
|
+
yield this.toDataURL(type).then((url) => {
|
|
1865
|
+
dataURL = url;
|
|
1866
|
+
});
|
|
1867
|
+
if (callback)
|
|
1868
|
+
callback(dataURL);
|
|
1869
|
+
}), 16);
|
|
1870
|
+
}
|
|
1871
|
+
/**
|
|
1872
|
+
* Asynchronously converts the entire canvas content to a Data URL of the specified type
|
|
1873
|
+
* with optional padding, and invokes the provided callback.
|
|
1874
|
+
* @param type The type of the Data URL (optional, defaults to 'image/png').
|
|
1875
|
+
* @param imageConfig Configuration options for the image (optional).
|
|
1876
|
+
* @param callback A callback function to handle the Data URL (optional).
|
|
1877
|
+
*/
|
|
1878
|
+
asyncToFullDataUrl(type, imageConfig, callback) {
|
|
1879
|
+
let dataURL = '';
|
|
1880
|
+
if (!type)
|
|
1881
|
+
type = 'image/png';
|
|
1882
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
1883
|
+
yield this.toFullDataURL(type, imageConfig).then((url) => {
|
|
1884
|
+
dataURL = url;
|
|
1885
|
+
});
|
|
1886
|
+
if (callback)
|
|
1887
|
+
callback(dataURL);
|
|
1888
|
+
}), 16);
|
|
1889
|
+
}
|
|
1518
1890
|
// ===== history operations =====
|
|
1519
1891
|
/**
|
|
1520
1892
|
* Determine if history (redo/undo) is enabled.
|
|
@@ -1536,16 +1908,16 @@ class Graph extends event_emitter_1.default {
|
|
|
1536
1908
|
/**
|
|
1537
1909
|
* Pause stacking operation.
|
|
1538
1910
|
*/
|
|
1539
|
-
|
|
1911
|
+
pauseStack() {
|
|
1540
1912
|
const history = this.getHistoryPlugin();
|
|
1541
|
-
return history === null || history === void 0 ? void 0 : history.
|
|
1913
|
+
return history === null || history === void 0 ? void 0 : history.pauseStack();
|
|
1542
1914
|
}
|
|
1543
1915
|
/**
|
|
1544
1916
|
* Resume stacking operation.
|
|
1545
1917
|
*/
|
|
1546
|
-
|
|
1918
|
+
resumeStack() {
|
|
1547
1919
|
const history = this.getHistoryPlugin();
|
|
1548
|
-
return history === null || history === void 0 ? void 0 : history.
|
|
1920
|
+
return history === null || history === void 0 ? void 0 : history.resumeStack();
|
|
1549
1921
|
}
|
|
1550
1922
|
/**
|
|
1551
1923
|
* Retrieve the current redo stack which consists of operations that could be undone
|
|
@@ -1602,38 +1974,38 @@ class Graph extends event_emitter_1.default {
|
|
|
1602
1974
|
return history === null || history === void 0 ? void 0 : history.canRedo();
|
|
1603
1975
|
}
|
|
1604
1976
|
/**
|
|
1605
|
-
* Begin a
|
|
1606
|
-
* Any operations performed between `
|
|
1977
|
+
* Begin a historyBatch operation.
|
|
1978
|
+
* Any operations performed between `startHistoryBatch` and `stopHistoryBatch` are grouped together.
|
|
1607
1979
|
* treated as a single operation when undoing or redoing.
|
|
1608
1980
|
*/
|
|
1609
|
-
|
|
1981
|
+
startHistoryBatch() {
|
|
1610
1982
|
const history = this.getHistoryPlugin();
|
|
1611
|
-
history === null || history === void 0 ? void 0 : history.
|
|
1983
|
+
history === null || history === void 0 ? void 0 : history.startHistoryBatch();
|
|
1612
1984
|
}
|
|
1613
1985
|
/**
|
|
1614
|
-
* End a
|
|
1615
|
-
* Any operations performed between `
|
|
1986
|
+
* End a historyBatch operation.
|
|
1987
|
+
* Any operations performed between `startHistoryBatch` and `stopHistoryBatch` are grouped together.
|
|
1616
1988
|
* treated as a single operation when undoing or redoing.
|
|
1617
1989
|
*/
|
|
1618
|
-
|
|
1990
|
+
stopHistoryBatch() {
|
|
1619
1991
|
const history = this.getHistoryPlugin();
|
|
1620
|
-
history === null || history === void 0 ? void 0 : history.
|
|
1992
|
+
history === null || history === void 0 ? void 0 : history.stopHistoryBatch();
|
|
1621
1993
|
}
|
|
1622
1994
|
/**
|
|
1623
1995
|
* Execute a provided function within a batched context
|
|
1624
1996
|
* All operations performed inside callback will be treated as a composite operation
|
|
1625
|
-
* more convenient way without manually invoking `
|
|
1997
|
+
* more convenient way without manually invoking `startHistoryBatch` and `stopHistoryBatch`.
|
|
1626
1998
|
* @param callback The func containing operations to be batched together.
|
|
1627
1999
|
*/
|
|
1628
|
-
|
|
2000
|
+
historyBatch(callback) {
|
|
1629
2001
|
const history = this.getHistoryPlugin();
|
|
1630
|
-
history === null || history === void 0 ? void 0 : history.
|
|
2002
|
+
history === null || history === void 0 ? void 0 : history.historyBatch(callback);
|
|
1631
2003
|
}
|
|
1632
2004
|
/**
|
|
1633
2005
|
* Clear history stack
|
|
1634
2006
|
* @param {StackType} stackType undo/redo stack
|
|
1635
2007
|
*/
|
|
1636
|
-
|
|
2008
|
+
cleanHistory(stackType) {
|
|
1637
2009
|
const history = this.getHistoryPlugin();
|
|
1638
2010
|
if (!stackType)
|
|
1639
2011
|
return history === null || history === void 0 ? void 0 : history.clear();
|
|
@@ -1685,7 +2057,7 @@ class Graph extends event_emitter_1.default {
|
|
|
1685
2057
|
this.backgroundCanvas.destroy();
|
|
1686
2058
|
this.transientCanvas.destroy();
|
|
1687
2059
|
// clear history stack
|
|
1688
|
-
this.
|
|
2060
|
+
this.cleanHistory();
|
|
1689
2061
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
1690
2062
|
// }, 500);
|
|
1691
2063
|
this.hooks.destroy.emit({});
|