@antv/g6 5.0.0-beta.2 → 5.0.0-beta.20
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/graph.d.ts +3 -3
- package/esm/api-doc/graph.js +3 -3
- package/esm/api-doc/graph.js.map +1 -1
- package/esm/api-doc/types.d.ts +1 -0
- package/esm/api-doc/types.js +1 -2
- package/esm/api-doc/types.js.map +1 -1
- package/esm/constant/shape.d.ts +3 -1
- package/esm/index.d.ts +24 -63
- package/esm/index.js +4 -5
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +1 -1
- package/esm/item/combo.js +18 -14
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +19 -2
- package/esm/item/edge.js +100 -44
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +3 -2
- package/esm/item/item.js +27 -13
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +2 -8
- package/esm/item/node.js +31 -19
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +7 -10
- package/esm/runtime/controller/data.js +125 -281
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/interaction.js +9 -4
- package/esm/runtime/controller/interaction.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +1 -0
- package/esm/runtime/controller/item.js +285 -150
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.js +1 -3
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/controller/plugin.js +9 -5
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/graph.d.ts +104 -24
- package/esm/runtime/graph.js +472 -94
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +1 -1
- package/esm/stdlib/behavior/activate-relations.js +2 -2
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.d.ts +9 -3
- package/esm/stdlib/behavior/brush-select.js +10 -12
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/click-select.d.ts +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/collapse-expand-combo.d.ts +1 -1
- package/esm/stdlib/behavior/collapse-expand-tree.d.ts +1 -1
- package/esm/stdlib/behavior/create-edge.d.ts +57 -0
- package/esm/stdlib/behavior/create-edge.js +215 -0
- package/esm/stdlib/behavior/create-edge.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +3 -1
- package/esm/stdlib/behavior/drag-canvas.js +78 -33
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +3 -3
- 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 +4 -4
- package/esm/stdlib/behavior/drag-node.js +80 -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 +3 -4
- 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 +87 -0
- package/esm/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.d.ts +3 -1
- package/esm/stdlib/behavior/zoom-canvas.js +70 -26
- 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 +13 -12
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +18 -6
- package/esm/stdlib/index.js +22 -10
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +3 -5
- package/esm/stdlib/item/edge/base.js +32 -31
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/esm/stdlib/item/edge/cubic.js +1 -1
- package/esm/stdlib/item/edge/cubic.js.map +1 -1
- package/esm/stdlib/item/edge/loop.js +1 -1
- package/esm/stdlib/item/edge/loop.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +3 -6
- package/esm/stdlib/item/node/base.js +30 -60
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.d.ts +1 -0
- package/esm/stdlib/item/node/base3d.js +1 -0
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/cube.d.ts +35 -0
- package/esm/stdlib/item/node/cube.js +54 -0
- package/esm/stdlib/item/node/cube.js.map +1 -0
- package/esm/stdlib/item/node/diamond.js +1 -1
- package/esm/stdlib/item/node/donut.d.ts +3 -3
- package/esm/stdlib/item/node/ellipse.js +2 -2
- package/esm/stdlib/item/node/hexagon.js +6 -2
- 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 +4 -0
- package/esm/stdlib/item/node/index.js +4 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js +309 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/esm/stdlib/plugin/grid/index.d.ts +1 -1
- package/esm/stdlib/plugin/grid/index.js +3 -4
- package/esm/stdlib/plugin/grid/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/convexHull.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +2 -2
- package/esm/stdlib/plugin/hull/hullComponent.js +5 -9
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/esm/stdlib/plugin/hull/util.d.ts +2 -2
- package/esm/stdlib/plugin/hull/util.js +6 -2
- package/esm/stdlib/plugin/hull/util.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.d.ts +3 -3
- package/esm/stdlib/plugin/legend/index.js +3 -3
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/menu/index.d.ts +4 -4
- package/esm/stdlib/plugin/menu/index.js +3 -3
- package/esm/stdlib/plugin/menu/index.js.map +1 -1
- package/esm/stdlib/plugin/minimap/index.d.ts +6 -2
- package/esm/stdlib/plugin/minimap/index.js +119 -12
- 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 +4 -4
- package/esm/stdlib/plugin/timebar/index.js +6 -6
- package/esm/stdlib/plugin/timebar/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/esm/stdlib/plugin/toolbar/index.js +4 -4
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/plugin/tooltip/index.d.ts +5 -5
- package/esm/stdlib/plugin/tooltip/index.js +3 -4
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
- package/esm/stdlib/plugin/types.d.ts +2 -0
- package/esm/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/esm/stdlib/plugin/watermaker/index.js +243 -0
- package/esm/stdlib/plugin/watermaker/index.js.map +1 -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/animate.d.ts +2 -2
- package/esm/types/behavior.d.ts +1 -1
- package/esm/types/combo.d.ts +7 -7
- package/esm/types/common.d.ts +5 -5
- package/esm/types/data.d.ts +6 -6
- package/esm/types/edge.d.ts +9 -9
- package/esm/types/event.d.ts +2 -1
- package/esm/types/graph.d.ts +48 -22
- package/esm/types/history.d.ts +2 -2
- package/esm/types/hook.d.ts +23 -3
- package/esm/types/index.d.ts +2 -1
- package/esm/types/index.js +1 -0
- package/esm/types/index.js.map +1 -1
- package/esm/types/item.d.ts +18 -12
- package/esm/types/item.js.map +1 -1
- package/esm/types/layout.d.ts +6 -6
- package/esm/types/loop.d.ts +2 -2
- package/esm/types/node.d.ts +7 -7
- package/esm/types/plugin.d.ts +1 -1
- package/esm/types/render.d.ts +1 -1
- package/esm/types/spec.d.ts +19 -3
- package/esm/types/stdlib.d.ts +1 -1
- package/esm/types/theme.d.ts +8 -8
- package/esm/types/view.d.ts +7 -2
- package/esm/util/bbox.d.ts +16 -1
- package/esm/util/bbox.js +33 -5
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/behavior.d.ts +2 -2
- package/esm/util/behavior.js +2 -2
- package/esm/util/behavior.js.map +1 -1
- package/esm/util/data.d.ts +2 -2
- package/esm/util/data.js.map +1 -1
- package/esm/util/dom.d.ts +15 -0
- package/esm/util/dom.js +29 -0
- package/esm/util/dom.js.map +1 -0
- package/esm/util/event.d.ts +5 -3
- package/esm/util/event.js +8 -1
- package/esm/util/event.js.map +1 -1
- package/esm/util/extend.d.ts +1 -1
- package/esm/util/extend.js +0 -1
- package/esm/util/extend.js.map +1 -1
- package/esm/util/index.d.ts +7 -52
- package/esm/util/index.js +7 -23
- package/esm/util/index.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 +13 -2
- package/esm/util/layout.js +45 -0
- package/esm/util/layout.js.map +1 -1
- package/esm/util/loop.d.ts +1 -1
- package/esm/util/loop.js +4 -0
- package/esm/util/loop.js.map +1 -1
- package/esm/util/math.d.ts +1 -1
- package/esm/util/matrix.d.ts +6 -0
- package/esm/util/matrix.js +48 -0
- package/esm/util/matrix.js.map +1 -0
- package/esm/util/path.js +1 -1
- package/esm/util/path.js.map +1 -1
- package/esm/util/point.d.ts +1 -1
- package/esm/util/point.js +9 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/polyline.d.ts +2 -1
- package/esm/util/polyline.js +2 -1
- package/esm/util/polyline.js.map +1 -1
- package/esm/util/router.d.ts +1 -1
- package/esm/util/shape.d.ts +1 -2
- package/esm/util/shape.js +15 -25
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.js +16 -17
- package/esm/util/shape3d.js.map +1 -1
- package/esm/util/text.d.ts +1 -1
- package/esm/util/text.js +3 -2
- package/esm/util/text.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/graph.d.ts +3 -3
- package/lib/api-doc/graph.js +27 -7
- package/lib/api-doc/graph.js.map +1 -1
- package/lib/api-doc/types.d.ts +1 -0
- package/lib/api-doc/types.js +2 -2
- package/lib/api-doc/types.js.map +1 -1
- package/lib/constant/shape.d.ts +3 -1
- package/lib/index.d.ts +24 -63
- package/lib/index.js +18 -10
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +1 -1
- package/lib/item/combo.js +18 -14
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +19 -2
- package/lib/item/edge.js +99 -43
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +3 -2
- package/lib/item/item.js +27 -13
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +2 -8
- package/lib/item/node.js +31 -19
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +7 -10
- package/lib/runtime/controller/data.js +125 -281
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/interaction.js +9 -4
- package/lib/runtime/controller/interaction.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +1 -0
- package/lib/runtime/controller/item.js +284 -149
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.js +1 -3
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/controller/plugin.js +9 -5
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/graph.d.ts +104 -24
- package/lib/runtime/graph.js +473 -94
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +1 -1
- package/lib/stdlib/behavior/activate-relations.js +2 -2
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.d.ts +9 -3
- package/lib/stdlib/behavior/brush-select.js +13 -12
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/click-select.d.ts +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/collapse-expand-combo.d.ts +1 -1
- package/lib/stdlib/behavior/collapse-expand-tree.d.ts +1 -1
- package/lib/stdlib/behavior/create-edge.d.ts +57 -0
- package/lib/stdlib/behavior/create-edge.js +219 -0
- package/lib/stdlib/behavior/create-edge.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +3 -1
- package/lib/stdlib/behavior/drag-canvas.js +78 -33
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +3 -3
- 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 +4 -4
- package/lib/stdlib/behavior/drag-node.js +80 -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 +6 -4
- 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 +91 -0
- package/lib/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.d.ts +3 -1
- package/lib/stdlib/behavior/zoom-canvas.js +70 -26
- 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 +13 -12
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +18 -6
- package/lib/stdlib/index.js +22 -10
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +3 -5
- package/lib/stdlib/item/edge/base.js +30 -29
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/lib/stdlib/item/edge/cubic.js +2 -2
- package/lib/stdlib/item/edge/cubic.js.map +1 -1
- package/lib/stdlib/item/edge/loop.js +3 -3
- package/lib/stdlib/item/edge/loop.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +3 -6
- package/lib/stdlib/item/node/base.js +29 -59
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.d.ts +1 -0
- package/lib/stdlib/item/node/base3d.js +1 -0
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/cube.d.ts +35 -0
- package/lib/stdlib/item/node/cube.js +58 -0
- package/lib/stdlib/item/node/cube.js.map +1 -0
- package/lib/stdlib/item/node/diamond.js +1 -1
- package/lib/stdlib/item/node/donut.d.ts +3 -3
- package/lib/stdlib/item/node/ellipse.js +2 -2
- package/lib/stdlib/item/node/hexagon.js +6 -2
- 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 +4 -0
- package/lib/stdlib/item/node/index.js +4 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js +313 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/lib/stdlib/plugin/grid/index.d.ts +1 -1
- package/lib/stdlib/plugin/grid/index.js +6 -7
- package/lib/stdlib/plugin/grid/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/convexHull.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +2 -2
- package/lib/stdlib/plugin/hull/hullComponent.js +5 -9
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/lib/stdlib/plugin/hull/util.d.ts +2 -2
- package/lib/stdlib/plugin/hull/util.js +26 -22
- package/lib/stdlib/plugin/hull/util.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.d.ts +3 -3
- package/lib/stdlib/plugin/legend/index.js +3 -3
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/menu/index.d.ts +4 -4
- package/lib/stdlib/plugin/menu/index.js +6 -6
- package/lib/stdlib/plugin/menu/index.js.map +1 -1
- package/lib/stdlib/plugin/minimap/index.d.ts +6 -2
- package/lib/stdlib/plugin/minimap/index.js +121 -14
- 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 +4 -4
- package/lib/stdlib/plugin/timebar/index.js +6 -6
- package/lib/stdlib/plugin/timebar/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/lib/stdlib/plugin/toolbar/index.js +5 -5
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/plugin/tooltip/index.d.ts +5 -5
- package/lib/stdlib/plugin/tooltip/index.js +10 -11
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
- package/lib/stdlib/plugin/types.d.ts +2 -0
- package/lib/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/lib/stdlib/plugin/watermaker/index.js +247 -0
- package/lib/stdlib/plugin/watermaker/index.js.map +1 -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/animate.d.ts +2 -2
- package/lib/types/behavior.d.ts +1 -1
- package/lib/types/combo.d.ts +7 -7
- package/lib/types/common.d.ts +5 -5
- package/lib/types/data.d.ts +6 -6
- package/lib/types/edge.d.ts +9 -9
- package/lib/types/event.d.ts +2 -1
- package/lib/types/event.js +2 -2
- package/lib/types/event.js.map +1 -1
- package/lib/types/graph.d.ts +48 -22
- package/lib/types/history.d.ts +2 -2
- package/lib/types/history.js +1 -1
- package/lib/types/history.js.map +1 -1
- package/lib/types/hook.d.ts +23 -3
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.js +3 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/item.d.ts +18 -12
- package/lib/types/item.js +1 -1
- package/lib/types/item.js.map +1 -1
- package/lib/types/layout.d.ts +6 -6
- package/lib/types/loop.d.ts +2 -2
- package/lib/types/loop.js +1 -1
- package/lib/types/loop.js.map +1 -1
- package/lib/types/node.d.ts +7 -7
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/render.d.ts +1 -1
- package/lib/types/spec.d.ts +19 -3
- package/lib/types/stdlib.d.ts +1 -1
- package/lib/types/theme.d.ts +8 -8
- package/lib/types/view.d.ts +7 -2
- package/lib/util/bbox.d.ts +16 -1
- package/lib/util/bbox.js +36 -6
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/behavior.d.ts +2 -2
- package/lib/util/behavior.js +2 -2
- package/lib/util/behavior.js.map +1 -1
- package/lib/util/data.d.ts +2 -2
- package/lib/util/data.js.map +1 -1
- package/lib/util/dom.d.ts +15 -0
- package/lib/util/dom.js +34 -0
- package/lib/util/dom.js.map +1 -0
- package/lib/util/event.d.ts +5 -3
- package/lib/util/event.js +8 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/extend.d.ts +1 -1
- package/lib/util/extend.js +0 -1
- package/lib/util/extend.js.map +1 -1
- package/lib/util/index.d.ts +7 -52
- package/lib/util/index.js +23 -23
- package/lib/util/index.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 +13 -2
- package/lib/util/layout.js +47 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/loop.d.ts +1 -1
- package/lib/util/loop.js +4 -0
- package/lib/util/loop.js.map +1 -1
- package/lib/util/math.d.ts +1 -1
- package/lib/util/matrix.d.ts +6 -0
- package/lib/util/matrix.js +52 -0
- package/lib/util/matrix.js.map +1 -0
- package/lib/util/path.js +2 -2
- package/lib/util/path.js.map +1 -1
- package/lib/util/point.d.ts +1 -1
- package/lib/util/point.js +9 -2
- package/lib/util/point.js.map +1 -1
- package/lib/util/polyline.d.ts +2 -1
- package/lib/util/polyline.js +2 -1
- package/lib/util/polyline.js.map +1 -1
- package/lib/util/router.d.ts +1 -1
- package/lib/util/shape.d.ts +1 -2
- package/lib/util/shape.js +16 -26
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.js +15 -16
- package/lib/util/shape3d.js.map +1 -1
- package/lib/util/text.d.ts +1 -1
- package/lib/util/text.js +3 -2
- package/lib/util/text.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 +41 -50
- package/src/api-doc/graph.ts +4 -3
- package/src/api-doc/types.ts +1 -0
- package/src/constant/shape.ts +1 -1
- package/src/index.ts +5 -6
- package/src/item/combo.ts +16 -15
- package/src/item/edge.ts +135 -57
- package/src/item/item.ts +32 -19
- package/src/item/node.ts +36 -50
- package/src/runtime/controller/data.ts +140 -339
- package/src/runtime/controller/interaction.ts +10 -4
- package/src/runtime/controller/item.ts +261 -78
- package/src/runtime/controller/layout.ts +1 -5
- package/src/runtime/controller/plugin.ts +15 -4
- package/src/runtime/graph.ts +605 -103
- package/src/stdlib/behavior/activate-relations.ts +2 -2
- package/src/stdlib/behavior/brush-select.ts +14 -13
- package/src/stdlib/behavior/click-select.ts +1 -1
- package/src/stdlib/behavior/create-edge.ts +305 -0
- package/src/stdlib/behavior/drag-canvas.ts +107 -35
- package/src/stdlib/behavior/drag-combo.ts +10 -10
- package/src/stdlib/behavior/drag-node.ts +27 -18
- package/src/stdlib/behavior/index.ts +3 -0
- package/src/stdlib/behavior/lasso-select.ts +7 -5
- package/src/stdlib/behavior/scroll-canvas.ts +348 -0
- package/src/stdlib/behavior/shortcuts-call.ts +129 -0
- package/src/stdlib/behavior/zoom-canvas-3d.ts +4 -1
- package/src/stdlib/behavior/zoom-canvas.ts +98 -27
- package/src/stdlib/data/mapNodeSize.ts +2 -2
- package/src/stdlib/data/transformV4Data.ts +2 -2
- package/src/stdlib/data/validateData.ts +16 -16
- package/src/stdlib/index.ts +28 -7
- package/src/stdlib/item/edge/base.ts +32 -41
- package/src/stdlib/item/edge/cubic-horizontal.ts +0 -1
- package/src/stdlib/item/edge/cubic-vertical.ts +0 -1
- package/src/stdlib/item/edge/cubic.ts +1 -1
- package/src/stdlib/item/edge/loop.ts +1 -1
- package/src/stdlib/item/node/base.ts +38 -65
- package/src/stdlib/item/node/base3d.ts +1 -0
- package/src/stdlib/item/node/cube.ts +102 -0
- 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 +6 -2
- package/src/stdlib/item/node/image.ts +190 -0
- package/src/stdlib/item/node/index.ts +4 -0
- package/src/stdlib/plugin/edgeFilterLens/index.ts +387 -0
- package/src/stdlib/plugin/grid/index.ts +6 -6
- 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/convexHull.ts +1 -1
- package/src/stdlib/plugin/hull/hullComponent.ts +10 -8
- package/src/stdlib/plugin/hull/util.ts +6 -2
- package/src/stdlib/plugin/index.ts +2 -0
- package/src/stdlib/plugin/legend/index.ts +6 -6
- package/src/stdlib/plugin/menu/index.ts +13 -13
- package/src/stdlib/plugin/minimap/index.ts +126 -16
- package/src/stdlib/plugin/snapline/index.ts +1297 -0
- package/src/stdlib/plugin/timebar/index.ts +4 -4
- package/src/stdlib/plugin/toolbar/index.ts +8 -8
- package/src/stdlib/plugin/tooltip/index.ts +10 -10
- package/src/stdlib/plugin/types.ts +2 -0
- package/src/stdlib/plugin/watermaker/index.ts +302 -0
- package/src/stdlib/theme/dark.ts +66 -2
- package/src/stdlib/theme/light.ts +4 -4
- package/src/types/event.ts +1 -0
- package/src/types/graph.ts +62 -25
- package/src/types/hook.ts +22 -2
- package/src/types/index.ts +2 -1
- package/src/types/item.ts +10 -0
- package/src/types/plugin.ts +1 -1
- package/src/types/spec.ts +22 -3
- package/src/types/view.ts +8 -3
- package/src/util/bbox.ts +42 -6
- package/src/util/behavior.ts +4 -4
- package/src/util/data.ts +2 -3
- package/src/util/dom.ts +33 -0
- package/src/util/event.ts +14 -1
- package/src/util/extend.ts +2 -3
- package/src/util/index.ts +7 -24
- package/src/util/item.ts +65 -28
- package/src/util/layout.ts +48 -2
- package/src/util/loop.ts +5 -1
- package/src/util/math.ts +1 -1
- package/src/util/matrix.ts +66 -0
- package/src/util/path.ts +1 -1
- package/src/util/point.ts +9 -4
- package/src/util/polyline.ts +2 -1
- package/src/util/router.ts +1 -1
- package/src/util/shape.ts +22 -26
- package/src/util/shape3d.ts +20 -20
- package/src/util/text.ts +3 -1
- package/src/util/warn.ts +20 -0
package/src/item/edge.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Circle, Group } from '@antv/g';
|
|
2
2
|
import { clone, throttle } from '@antv/util';
|
|
3
|
-
import { EdgeDisplayModel, EdgeModel, ID } from '../types';
|
|
3
|
+
import { EdgeDisplayModel, EdgeModel, ID, Point } from '../types';
|
|
4
4
|
import { EdgeModelData } from '../types/edge';
|
|
5
5
|
import { DisplayMapper, State, LodStrategyObj } from '../types/item';
|
|
6
6
|
import { updateShapes } from '../util/shape';
|
|
@@ -28,6 +28,7 @@ interface IProps {
|
|
|
28
28
|
};
|
|
29
29
|
onframe?: Function;
|
|
30
30
|
nodeMap?: Map<ID, Node>;
|
|
31
|
+
delayFirstDraw?: boolean;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export default class Edge extends Item {
|
|
@@ -42,6 +43,15 @@ export default class Edge extends Item {
|
|
|
42
43
|
public sourceItem: Node | Combo;
|
|
43
44
|
public targetItem: Node | Combo;
|
|
44
45
|
|
|
46
|
+
/** Caches to avoid unnecessary calculations. */
|
|
47
|
+
private cache: {
|
|
48
|
+
sourcePositionCache?: Point;
|
|
49
|
+
targetPositionCache?: Point;
|
|
50
|
+
controlPointsCache?: Point;
|
|
51
|
+
sourcePointCache?: Point;
|
|
52
|
+
targetPointCache?: Point;
|
|
53
|
+
} = {};
|
|
54
|
+
|
|
45
55
|
constructor(props: IProps) {
|
|
46
56
|
super(props);
|
|
47
57
|
this.init({ ...props, type: 'edge' });
|
|
@@ -56,7 +66,9 @@ export default class Edge extends Item {
|
|
|
56
66
|
if (sourceItem.getType() === 'node') {
|
|
57
67
|
this.nodeMap.set(targetItem.getID(), targetItem as Node);
|
|
58
68
|
}
|
|
59
|
-
|
|
69
|
+
if (!props.delayFirstDraw) {
|
|
70
|
+
this.draw(this.displayModel);
|
|
71
|
+
}
|
|
60
72
|
}
|
|
61
73
|
public draw(
|
|
62
74
|
displayModel: EdgeDisplayModel,
|
|
@@ -65,40 +77,7 @@ export default class Edge extends Item {
|
|
|
65
77
|
animate = true,
|
|
66
78
|
onfinish: Function = () => {},
|
|
67
79
|
) {
|
|
68
|
-
|
|
69
|
-
const { sourceAnchor, targetAnchor, keyShape } = displayModel.data;
|
|
70
|
-
const sourcePosition = this.sourceItem.getPosition();
|
|
71
|
-
const targetPosition = this.targetItem.getPosition();
|
|
72
|
-
|
|
73
|
-
let targetPrevious = sourcePosition;
|
|
74
|
-
let sourcePrevious = targetPosition;
|
|
75
|
-
|
|
76
|
-
// TODO: type
|
|
77
|
-
// @ts-ignore
|
|
78
|
-
if (keyShape?.controlPoints?.length) {
|
|
79
|
-
// @ts-ignore
|
|
80
|
-
const controlPointsBesideEnds = keyShape.controlPoints.filter(
|
|
81
|
-
(point) =>
|
|
82
|
-
!isSamePoint(point, sourcePosition) &&
|
|
83
|
-
!isSamePoint(point, targetPosition),
|
|
84
|
-
);
|
|
85
|
-
sourcePrevious = getNearestPoint(
|
|
86
|
-
controlPointsBesideEnds,
|
|
87
|
-
sourcePosition,
|
|
88
|
-
).nearestPoint;
|
|
89
|
-
targetPrevious = getNearestPoint(
|
|
90
|
-
controlPointsBesideEnds,
|
|
91
|
-
targetPosition,
|
|
92
|
-
).nearestPoint;
|
|
93
|
-
}
|
|
94
|
-
const sourcePoint = this.sourceItem.getAnchorPoint(
|
|
95
|
-
sourcePrevious,
|
|
96
|
-
sourceAnchor,
|
|
97
|
-
);
|
|
98
|
-
const targetPoint = this.targetItem.getAnchorPoint(
|
|
99
|
-
targetPrevious,
|
|
100
|
-
targetAnchor,
|
|
101
|
-
);
|
|
80
|
+
const { sourcePoint, targetPoint } = this.getEndPoints(displayModel);
|
|
102
81
|
this.renderExt.mergeStyles(displayModel);
|
|
103
82
|
const firstRendering = !this.shapeMap?.keyShape;
|
|
104
83
|
this.renderExt.setSourcePoint(sourcePoint);
|
|
@@ -115,7 +94,11 @@ export default class Edge extends Item {
|
|
|
115
94
|
);
|
|
116
95
|
|
|
117
96
|
// add shapes to group, and update shapeMap
|
|
118
|
-
this.shapeMap = updateShapes(
|
|
97
|
+
this.shapeMap = updateShapes(
|
|
98
|
+
this.shapeMap,
|
|
99
|
+
{ ...shapeMap, ...this.afterDrawShapeMap },
|
|
100
|
+
this.group,
|
|
101
|
+
);
|
|
119
102
|
|
|
120
103
|
// handle shape's and group's animate
|
|
121
104
|
const { animates, disableAnimate } = displayModel.data;
|
|
@@ -161,16 +144,23 @@ export default class Edge extends Item {
|
|
|
161
144
|
* Sometimes no changes on edge data, but need to re-draw it
|
|
162
145
|
* e.g. source and target nodes' position changed
|
|
163
146
|
*/
|
|
164
|
-
public forceUpdate
|
|
165
|
-
()
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
147
|
+
public forceUpdate() {
|
|
148
|
+
if (this.destroyed) return;
|
|
149
|
+
const { sourcePoint, targetPoint, changed } = this.getEndPoints(
|
|
150
|
+
this.displayModel,
|
|
151
|
+
);
|
|
152
|
+
if (!changed) return;
|
|
153
|
+
this.renderExt.setSourcePoint(sourcePoint);
|
|
154
|
+
this.renderExt.setTargetPoint(targetPoint);
|
|
155
|
+
const shapeMap = this.renderExt.draw(
|
|
156
|
+
this.displayModel,
|
|
157
|
+
sourcePoint,
|
|
158
|
+
targetPoint,
|
|
159
|
+
this.shapeMap,
|
|
160
|
+
);
|
|
161
|
+
// add shapes to group, and update shapeMap
|
|
162
|
+
this.shapeMap = updateShapes(this.shapeMap, shapeMap, this.group);
|
|
163
|
+
}
|
|
174
164
|
|
|
175
165
|
/**
|
|
176
166
|
* Update end item for item and re-draw the edge
|
|
@@ -183,23 +173,111 @@ export default class Edge extends Item {
|
|
|
183
173
|
this.draw(this.displayModel);
|
|
184
174
|
}
|
|
185
175
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Calculate the source and target points according to the source and target nodes and the anchorPoints and controlPoints.
|
|
178
|
+
* @param displayModel
|
|
179
|
+
* @returns
|
|
180
|
+
*/
|
|
181
|
+
private getEndPoints(displayModel: EdgeDisplayModel) {
|
|
182
|
+
// get the point near the other end
|
|
183
|
+
const { sourceAnchor, targetAnchor, keyShape } = displayModel.data;
|
|
184
|
+
const sourcePosition = this.sourceItem.getPosition();
|
|
185
|
+
const targetPosition = this.targetItem.getPosition();
|
|
186
|
+
|
|
187
|
+
if (
|
|
188
|
+
!this.shouldUpdatePoints(
|
|
189
|
+
sourcePosition,
|
|
190
|
+
targetPosition,
|
|
191
|
+
// @ts-ignore
|
|
192
|
+
keyShape?.controlPoints,
|
|
193
|
+
)
|
|
194
|
+
) {
|
|
195
|
+
return {
|
|
196
|
+
sourcePoint: this.cache.sourcePointCache,
|
|
197
|
+
targetPoint: this.cache.targetPointCache,
|
|
198
|
+
changed: false,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
let targetPrevious = sourcePosition;
|
|
203
|
+
let sourcePrevious = targetPosition;
|
|
204
|
+
|
|
205
|
+
// TODO: type
|
|
206
|
+
// @ts-ignore
|
|
207
|
+
if (keyShape?.controlPoints?.length) {
|
|
208
|
+
// @ts-ignore
|
|
209
|
+
const controlPointsBesideEnds = keyShape.controlPoints.filter(
|
|
210
|
+
(point) =>
|
|
211
|
+
!isSamePoint(point, sourcePosition) &&
|
|
212
|
+
!isSamePoint(point, targetPosition),
|
|
213
|
+
);
|
|
214
|
+
sourcePrevious = getNearestPoint(
|
|
215
|
+
controlPointsBesideEnds,
|
|
216
|
+
sourcePosition,
|
|
217
|
+
).nearestPoint;
|
|
218
|
+
targetPrevious = getNearestPoint(
|
|
219
|
+
controlPointsBesideEnds,
|
|
220
|
+
targetPosition,
|
|
221
|
+
).nearestPoint;
|
|
222
|
+
}
|
|
223
|
+
this.cache.sourcePointCache = this.sourceItem.getAnchorPoint(
|
|
224
|
+
sourcePrevious,
|
|
225
|
+
sourceAnchor,
|
|
226
|
+
);
|
|
227
|
+
this.cache.targetPointCache = this.targetItem.getAnchorPoint(
|
|
228
|
+
targetPrevious,
|
|
229
|
+
targetAnchor,
|
|
230
|
+
);
|
|
231
|
+
return {
|
|
232
|
+
sourcePoint: this.cache.sourcePointCache,
|
|
233
|
+
targetPoint: this.cache.targetPointCache,
|
|
234
|
+
changed: true,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Returns false if the source, target, controlPoints are not changed, avoiding unnecessary computations.
|
|
240
|
+
* @param sourcePosition
|
|
241
|
+
* @param targetPosition
|
|
242
|
+
* @param controlPoints
|
|
243
|
+
* @returns
|
|
244
|
+
*/
|
|
245
|
+
private shouldUpdatePoints(sourcePosition, targetPosition, controlPoints) {
|
|
246
|
+
const isComboEnd =
|
|
247
|
+
this.sourceItem.type === 'combo' || this.targetItem.type === 'combo';
|
|
248
|
+
const changed =
|
|
249
|
+
!(
|
|
250
|
+
isSamePoint(sourcePosition, this.cache.sourcePositionCache) &&
|
|
251
|
+
isSamePoint(targetPosition, this.cache.targetPositionCache) &&
|
|
252
|
+
controlPoints === this.cache.controlPointsCache
|
|
253
|
+
) || isComboEnd;
|
|
254
|
+
if (changed) {
|
|
255
|
+
this.cache.sourcePositionCache = sourcePosition;
|
|
256
|
+
this.cache.targetPositionCache = targetPosition;
|
|
257
|
+
this.cache.controlPointsCache = controlPoints;
|
|
258
|
+
}
|
|
259
|
+
return changed;
|
|
260
|
+
}
|
|
189
261
|
|
|
190
262
|
public clone(
|
|
191
263
|
containerGroup: Group,
|
|
192
264
|
sourceItem: Node | Combo,
|
|
193
265
|
targetItem: Node | Combo,
|
|
194
|
-
|
|
266
|
+
shapeIds?: string[],
|
|
195
267
|
disableAnimate?: boolean,
|
|
196
268
|
) {
|
|
197
|
-
if (
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
269
|
+
if (shapeIds?.length) {
|
|
270
|
+
const group = new Group();
|
|
271
|
+
shapeIds.forEach((shapeId) => {
|
|
272
|
+
if (!this.shapeMap[shapeId] || this.shapeMap[shapeId].destroyed) return;
|
|
273
|
+
const clonedKeyShape = this.shapeMap[shapeId].cloneNode();
|
|
274
|
+
// TODO: other animating attributes?
|
|
275
|
+
clonedKeyShape.style.opacity =
|
|
276
|
+
this.renderExt.mergedStyles[shapeId]?.opacity || 1;
|
|
277
|
+
group.appendChild(clonedKeyShape);
|
|
278
|
+
});
|
|
279
|
+
containerGroup.appendChild(group);
|
|
280
|
+
return group;
|
|
203
281
|
}
|
|
204
282
|
const clonedModel = clone(this.model);
|
|
205
283
|
clonedModel.data.disableAnimate = disableAnimate;
|
package/src/item/item.ts
CHANGED
|
@@ -90,7 +90,8 @@ export default abstract class Item implements IItem {
|
|
|
90
90
|
/** Cache the dirty tags for states when data changed, to re-map the state styles when state changed */
|
|
91
91
|
private stateDirtyMap: { [stateName: string]: boolean } = {};
|
|
92
92
|
private cacheStateStyles: { [stateName: string]: ItemShapeStyles } = {};
|
|
93
|
-
private
|
|
93
|
+
private cacheNotHiddenByItem: { [shapeId: string]: boolean } = {};
|
|
94
|
+
private cacheHiddenByItem: { [shapeId: string]: boolean } = {};
|
|
94
95
|
|
|
95
96
|
// TODO: props type
|
|
96
97
|
constructor(props) {
|
|
@@ -124,6 +125,7 @@ export default abstract class Item implements IItem {
|
|
|
124
125
|
const {
|
|
125
126
|
type = this.type === 'edge' ? 'line-edge' : `circle-${this.type}`,
|
|
126
127
|
lodStrategy: modelLodStrategy,
|
|
128
|
+
enableBalanceShape,
|
|
127
129
|
} = this.displayModel.data;
|
|
128
130
|
const RenderExtension = renderExtensions.find((ext) => ext.type === type);
|
|
129
131
|
this.themeStyles = theme.styles;
|
|
@@ -148,6 +150,7 @@ export default abstract class Item implements IItem {
|
|
|
148
150
|
this.renderExt = new RenderExtension({
|
|
149
151
|
themeStyles: this.themeStyles?.default,
|
|
150
152
|
lodStrategy,
|
|
153
|
+
enableBalanceShape,
|
|
151
154
|
device: this.device,
|
|
152
155
|
zoom: this.zoom,
|
|
153
156
|
});
|
|
@@ -305,11 +308,13 @@ export default abstract class Item implements IItem {
|
|
|
305
308
|
|
|
306
309
|
// === mapper is function, displayModel is mapper(model), cannot diff the displayModel, so all the shapes need to be updated ===
|
|
307
310
|
if (isFunction(mapper)) {
|
|
311
|
+
const mappedModel = {
|
|
312
|
+
...defaultMapper(innerModel),
|
|
313
|
+
...(mapper as Function)(innerModel),
|
|
314
|
+
};
|
|
308
315
|
return {
|
|
309
|
-
model:
|
|
310
|
-
|
|
311
|
-
...(mapper as Function)(innerModel),
|
|
312
|
-
},
|
|
316
|
+
model: mappedModel,
|
|
317
|
+
typeChange: this.displayModel?.data?.type !== mappedModel.data.type,
|
|
313
318
|
};
|
|
314
319
|
}
|
|
315
320
|
|
|
@@ -411,7 +416,7 @@ export default abstract class Item implements IItem {
|
|
|
411
416
|
/** Show the item. */
|
|
412
417
|
public show(animate = true) {
|
|
413
418
|
Promise.all(this.stopAnimations()).finally(() => {
|
|
414
|
-
if (this.destroyed
|
|
419
|
+
if (this.destroyed) return;
|
|
415
420
|
const { animates = {} } = this.displayModel.data;
|
|
416
421
|
if (animate && animates.show?.length) {
|
|
417
422
|
const showAnimateFieldsMap: any = {};
|
|
@@ -424,7 +429,7 @@ export default abstract class Item implements IItem {
|
|
|
424
429
|
const targetStyleMap = {};
|
|
425
430
|
Object.keys(this.shapeMap).forEach((id) => {
|
|
426
431
|
const shape = this.shapeMap[id];
|
|
427
|
-
if (
|
|
432
|
+
if (this.cacheHiddenByItem[id]) {
|
|
428
433
|
// set the animate fields to initial value
|
|
429
434
|
if (showAnimateFieldsMap[id]) {
|
|
430
435
|
targetStyleMap[id] = targetStyleMap[id] || {};
|
|
@@ -439,7 +444,7 @@ export default abstract class Item implements IItem {
|
|
|
439
444
|
shape.show();
|
|
440
445
|
}
|
|
441
446
|
});
|
|
442
|
-
if (showAnimateFieldsMap.group) {
|
|
447
|
+
if (showAnimateFieldsMap.group && !this.shapeMap.keyShape.isVisible()) {
|
|
443
448
|
showAnimateFieldsMap.group.forEach((field) => {
|
|
444
449
|
const usingField = field === 'size' ? 'transform' : field;
|
|
445
450
|
if (GROUP_ANIMATE_STYLES[0].hasOwnProperty(usingField)) {
|
|
@@ -449,34 +454,42 @@ export default abstract class Item implements IItem {
|
|
|
449
454
|
});
|
|
450
455
|
}
|
|
451
456
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
+
if (Object.keys(targetStyleMap).length) {
|
|
458
|
+
this.animations = this.runWithAnimates(
|
|
459
|
+
animates,
|
|
460
|
+
'show',
|
|
461
|
+
targetStyleMap,
|
|
462
|
+
);
|
|
463
|
+
}
|
|
457
464
|
} else {
|
|
458
465
|
Object.keys(this.shapeMap).forEach((id) => {
|
|
459
466
|
const shape = this.shapeMap[id];
|
|
460
|
-
if (
|
|
467
|
+
if (this.cacheHiddenByItem[id]) shape.show();
|
|
461
468
|
});
|
|
462
469
|
}
|
|
463
470
|
|
|
464
471
|
this.visible = true;
|
|
472
|
+
this.cacheHiddenByItem = {};
|
|
465
473
|
});
|
|
466
474
|
}
|
|
467
475
|
|
|
468
476
|
/** Hides the item. */
|
|
469
|
-
public hide(animate = true) {
|
|
477
|
+
public hide(animate = true, keepKeyShape = false) {
|
|
478
|
+
this.cacheNotHiddenByItem = {};
|
|
470
479
|
const func = () => {
|
|
471
480
|
Object.keys(this.shapeMap).forEach((id) => {
|
|
481
|
+
if (keepKeyShape && id === 'keyShape') return;
|
|
472
482
|
const shape = this.shapeMap[id];
|
|
473
|
-
if (!
|
|
474
|
-
this.
|
|
483
|
+
if (!shape.isVisible()) {
|
|
484
|
+
this.cacheNotHiddenByItem[id] = true;
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
475
487
|
shape.hide();
|
|
488
|
+
this.cacheHiddenByItem[id] = true;
|
|
476
489
|
});
|
|
477
490
|
};
|
|
478
491
|
Promise.all(this.stopAnimations()).then(() => {
|
|
479
|
-
if (this.destroyed
|
|
492
|
+
if (this.destroyed) return;
|
|
480
493
|
const { animates = {} } = this.displayModel.data;
|
|
481
494
|
if (animate && animates.hide?.length) {
|
|
482
495
|
this.animations = this.runWithAnimates(
|
|
@@ -802,7 +815,7 @@ export default abstract class Item implements IItem {
|
|
|
802
815
|
*/
|
|
803
816
|
public updateZoom(zoom) {
|
|
804
817
|
this.zoom = zoom;
|
|
805
|
-
this.renderExt.onZoom(this.shapeMap, zoom);
|
|
818
|
+
this.renderExt.onZoom(this.shapeMap, zoom, this.cacheHiddenByItem);
|
|
806
819
|
}
|
|
807
820
|
|
|
808
821
|
/** Destroy the item. */
|
package/src/item/node.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Group } from '@antv/g';
|
|
2
2
|
import { clone } from '@antv/util';
|
|
3
3
|
import { Point } from '../types/common';
|
|
4
4
|
import { ComboDisplayModel, ComboModel, NodeModel } from '../types';
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
getRectIntersectByPoint,
|
|
15
15
|
} from '../util/point';
|
|
16
16
|
import { ComboModelData } from '../types/combo';
|
|
17
|
-
import { isArraySame } from '../util/array';
|
|
18
17
|
import Item from './item';
|
|
19
18
|
|
|
20
19
|
interface IProps {
|
|
@@ -34,6 +33,7 @@ interface IProps {
|
|
|
34
33
|
onframe?: Function;
|
|
35
34
|
onfinish?: Function;
|
|
36
35
|
type?: 'node' | 'combo';
|
|
36
|
+
delayFirstDraw?: boolean;
|
|
37
37
|
}
|
|
38
38
|
export default class Node extends Item {
|
|
39
39
|
public type: 'node' | 'combo';
|
|
@@ -41,13 +41,15 @@ export default class Node extends Item {
|
|
|
41
41
|
constructor(props: IProps) {
|
|
42
42
|
super(props);
|
|
43
43
|
this.init({ ...props, type: props.type || 'node' });
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
if (!props.delayFirstDraw) {
|
|
45
|
+
this.draw(
|
|
46
|
+
this.displayModel as NodeDisplayModel | ComboDisplayModel,
|
|
47
|
+
undefined,
|
|
48
|
+
undefined,
|
|
49
|
+
!this.displayModel.data.disableAnimate,
|
|
50
|
+
props.onfinish,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
51
53
|
}
|
|
52
54
|
public draw(
|
|
53
55
|
displayModel: NodeDisplayModel | ComboDisplayModel,
|
|
@@ -76,7 +78,9 @@ export default class Node extends Item {
|
|
|
76
78
|
const { animates, disableAnimate, x = 0, y = 0, z = 0 } = displayModel.data;
|
|
77
79
|
if (firstRendering) {
|
|
78
80
|
// first rendering, move the group
|
|
79
|
-
group.
|
|
81
|
+
group.style.x = x;
|
|
82
|
+
group.style.y = y;
|
|
83
|
+
group.style.z = z;
|
|
80
84
|
} else {
|
|
81
85
|
// terminate previous animations
|
|
82
86
|
this.stopAnimations();
|
|
@@ -110,32 +114,6 @@ export default class Node extends Item {
|
|
|
110
114
|
}
|
|
111
115
|
}
|
|
112
116
|
|
|
113
|
-
public update(
|
|
114
|
-
model: NodeModel,
|
|
115
|
-
diffData?: {
|
|
116
|
-
previous: NodeModelData | ComboModelData;
|
|
117
|
-
current: NodeModelData | ComboModelData;
|
|
118
|
-
},
|
|
119
|
-
isReplace?: boolean,
|
|
120
|
-
theme?: {
|
|
121
|
-
styles: NodeStyleSet;
|
|
122
|
-
lodStrategy: LodStrategyObj;
|
|
123
|
-
},
|
|
124
|
-
onlyMove?: boolean,
|
|
125
|
-
animate?: boolean,
|
|
126
|
-
onfinish?: Function,
|
|
127
|
-
) {
|
|
128
|
-
super.update(
|
|
129
|
-
model,
|
|
130
|
-
diffData,
|
|
131
|
-
isReplace,
|
|
132
|
-
theme,
|
|
133
|
-
onlyMove,
|
|
134
|
-
animate,
|
|
135
|
-
onfinish,
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
117
|
/**
|
|
140
118
|
* Update the node's position,
|
|
141
119
|
* do not update other styles which leads to better performance than updating position by updateData.
|
|
@@ -192,23 +170,30 @@ export default class Node extends Item {
|
|
|
192
170
|
return;
|
|
193
171
|
}
|
|
194
172
|
}
|
|
195
|
-
group.
|
|
173
|
+
group.style.x = position.x;
|
|
174
|
+
group.style.y = position.y;
|
|
175
|
+
group.style.z = position.z;
|
|
196
176
|
onfinish(displayModel.id, !animate);
|
|
197
177
|
}
|
|
198
178
|
|
|
199
179
|
public clone(
|
|
200
180
|
containerGroup: Group,
|
|
201
|
-
|
|
181
|
+
shapeIds?: string[],
|
|
202
182
|
disableAnimate?: boolean,
|
|
203
183
|
) {
|
|
204
|
-
if (
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
184
|
+
if (shapeIds?.length) {
|
|
185
|
+
const group = new Group();
|
|
186
|
+
shapeIds.forEach((shapeId) => {
|
|
187
|
+
if (!this.shapeMap[shapeId] || this.shapeMap[shapeId].destroyed) return;
|
|
188
|
+
const clonedKeyShape = this.shapeMap[shapeId].cloneNode();
|
|
189
|
+
// TODO: other animating attributes?
|
|
190
|
+
clonedKeyShape.style.opacity =
|
|
191
|
+
this.renderExt.mergedStyles[shapeId]?.opacity || 1;
|
|
192
|
+
group.appendChild(clonedKeyShape);
|
|
193
|
+
});
|
|
194
|
+
group.setPosition(this.group.getPosition());
|
|
195
|
+
containerGroup.appendChild(group);
|
|
196
|
+
return group;
|
|
212
197
|
}
|
|
213
198
|
const clonedModel = clone(this.model);
|
|
214
199
|
clonedModel.data.disableAnimate = disableAnimate;
|
|
@@ -301,8 +286,8 @@ export default class Node extends Item {
|
|
|
301
286
|
{
|
|
302
287
|
x: keyShapeRenderBBox.min[0],
|
|
303
288
|
y: keyShapeRenderBBox.min[1],
|
|
304
|
-
width:
|
|
305
|
-
height:
|
|
289
|
+
width: keyShapeWidth,
|
|
290
|
+
height: keyShapeHeight,
|
|
306
291
|
},
|
|
307
292
|
point,
|
|
308
293
|
);
|
|
@@ -321,15 +306,16 @@ export default class Node extends Item {
|
|
|
321
306
|
}
|
|
322
307
|
if (!linkPoint) {
|
|
323
308
|
// If the calculations above are all failed, return the data's position
|
|
324
|
-
return { x, y };
|
|
309
|
+
return { x, y, z };
|
|
325
310
|
}
|
|
311
|
+
if (!isNaN(z)) linkPoint.z = z;
|
|
326
312
|
return linkPoint;
|
|
327
313
|
}
|
|
328
314
|
|
|
329
315
|
public getPosition(): Point {
|
|
330
316
|
const initiated =
|
|
331
317
|
this.shapeMap.keyShape && this.group.attributes.x !== undefined;
|
|
332
|
-
if (initiated) {
|
|
318
|
+
if (initiated && this.renderExt.dimensions !== 3) {
|
|
333
319
|
const { center } = this.shapeMap.keyShape.getRenderBounds();
|
|
334
320
|
return { x: center[0], y: center[1], z: center[2] };
|
|
335
321
|
}
|