@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
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isNumber } from '@antv/util';
|
|
2
|
+
import { ID, IG6GraphEvent } from '../../types';
|
|
2
3
|
import { Behavior } from '../../types/behavior';
|
|
3
4
|
|
|
4
5
|
const VALID_TRIGGERS = ['wheel', 'upDownKeys'];
|
|
6
|
+
const WHEEL_DURATION = 250;
|
|
5
7
|
export interface ZoomCanvasOptions {
|
|
6
8
|
/**
|
|
7
9
|
* Whether enable optimize strategies, which will hide all the shapes excluding node keyShape while zooming.
|
|
@@ -56,9 +58,9 @@ export interface ZoomCanvasOptions {
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
const DEFAULT_OPTIONS: Required<ZoomCanvasOptions> = {
|
|
59
|
-
enableOptimize:
|
|
61
|
+
enableOptimize: undefined,
|
|
60
62
|
triggerOnItems: true,
|
|
61
|
-
sensitivity:
|
|
63
|
+
sensitivity: 6,
|
|
62
64
|
trigger: 'wheel',
|
|
63
65
|
secondaryKey: '',
|
|
64
66
|
speedUpKey: 'shift',
|
|
@@ -75,6 +77,8 @@ export class ZoomCanvas extends Behavior {
|
|
|
75
77
|
private hiddenEdgeIds: ID[];
|
|
76
78
|
private hiddenNodeIds: ID[];
|
|
77
79
|
private zoomTimer: ReturnType<typeof setTimeout>;
|
|
80
|
+
private tileRequestId?: number;
|
|
81
|
+
private lastWheelTriggerTime?: number;
|
|
78
82
|
|
|
79
83
|
constructor(options: Partial<ZoomCanvasOptions>) {
|
|
80
84
|
const finalOptions = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
@@ -114,43 +118,88 @@ export class ZoomCanvas extends Behavior {
|
|
|
114
118
|
|
|
115
119
|
private hideShapes() {
|
|
116
120
|
const { graph } = this;
|
|
117
|
-
|
|
121
|
+
const { tileBehavior: graphBehaviorOptimize, tileBehaviorSize = 1000 } =
|
|
122
|
+
graph.getSpecification().optimize || {};
|
|
123
|
+
const optimize =
|
|
124
|
+
this.options.enableOptimize !== undefined
|
|
125
|
+
? this.options.enableOptimize
|
|
126
|
+
: graphBehaviorOptimize;
|
|
127
|
+
const shouldOptimze = isNumber(optimize)
|
|
128
|
+
? graph.getAllNodesData().length > optimize
|
|
129
|
+
: optimize;
|
|
130
|
+
if (shouldOptimze) {
|
|
118
131
|
this.hiddenEdgeIds = graph
|
|
119
132
|
.getAllEdgesData()
|
|
120
133
|
.map((edge) => edge.id)
|
|
121
134
|
.filter((id) => graph.getItemVisible(id) === true);
|
|
122
|
-
// TODO
|
|
123
|
-
graph.hideItem(this.hiddenEdgeIds, false);
|
|
124
135
|
this.hiddenNodeIds = graph
|
|
125
136
|
.getAllNodesData()
|
|
126
137
|
.map((node) => node.id)
|
|
127
138
|
.filter((id) => graph.getItemVisible(id) === true);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
139
|
+
|
|
140
|
+
const hiddenIds = [...this.hiddenNodeIds];
|
|
141
|
+
const sectionNum = Math.ceil(hiddenIds.length / tileBehaviorSize);
|
|
142
|
+
const sections = Array.from({ length: sectionNum }, (v, i) =>
|
|
143
|
+
hiddenIds.slice(
|
|
144
|
+
i * tileBehaviorSize,
|
|
145
|
+
i * tileBehaviorSize + tileBehaviorSize,
|
|
146
|
+
),
|
|
147
|
+
);
|
|
148
|
+
const update = () => {
|
|
149
|
+
if (!sections.length && this.tileRequestId) {
|
|
150
|
+
cancelAnimationFrame(this.tileRequestId);
|
|
151
|
+
this.tileRequestId = undefined;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const section = sections.shift();
|
|
155
|
+
graph.startHistoryBatch();
|
|
156
|
+
graph.hideItem(section, false, true);
|
|
157
|
+
graph.stopHistoryBatch();
|
|
158
|
+
this.tileRequestId = requestAnimationFrame(update);
|
|
159
|
+
};
|
|
160
|
+
this.tileRequestId = requestAnimationFrame(update);
|
|
135
161
|
}
|
|
136
162
|
}
|
|
137
163
|
|
|
138
164
|
private endZoom() {
|
|
139
|
-
const { graph, hiddenEdgeIds, hiddenNodeIds } = this;
|
|
140
|
-
const {
|
|
165
|
+
const { graph, hiddenEdgeIds = [], hiddenNodeIds } = this;
|
|
166
|
+
const { tileBehavior: graphBehaviorOptimize, tileBehaviorSize = 1000 } =
|
|
167
|
+
graph.getSpecification().optimize || {};
|
|
168
|
+
const optimize =
|
|
169
|
+
this.options.enableOptimize !== undefined
|
|
170
|
+
? this.options.enableOptimize
|
|
171
|
+
: graphBehaviorOptimize;
|
|
172
|
+
const shouldOptimze = isNumber(optimize)
|
|
173
|
+
? graph.getAllNodesData().length > optimize
|
|
174
|
+
: optimize;
|
|
141
175
|
this.zooming = false;
|
|
142
|
-
if (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
176
|
+
if (shouldOptimze) {
|
|
177
|
+
if (this.tileRequestId) {
|
|
178
|
+
cancelAnimationFrame(this.tileRequestId);
|
|
179
|
+
this.tileRequestId = undefined;
|
|
180
|
+
}
|
|
181
|
+
if (hiddenNodeIds) {
|
|
182
|
+
const hiddenIds = [...hiddenNodeIds, ...hiddenEdgeIds];
|
|
183
|
+
const sectionNum = Math.ceil(hiddenIds.length / tileBehaviorSize);
|
|
184
|
+
const sections = Array.from({ length: sectionNum }, (v, i) =>
|
|
185
|
+
hiddenIds.slice(
|
|
186
|
+
i * tileBehaviorSize,
|
|
187
|
+
i * tileBehaviorSize + tileBehaviorSize,
|
|
188
|
+
),
|
|
189
|
+
);
|
|
190
|
+
const update = () => {
|
|
191
|
+
if (!sections.length && this.tileRequestId) {
|
|
192
|
+
cancelAnimationFrame(this.tileRequestId);
|
|
193
|
+
this.tileRequestId = undefined;
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
graph.executeWithNoStack(() => {
|
|
197
|
+
graph.showItem(sections.shift(), false);
|
|
198
|
+
});
|
|
199
|
+
this.tileRequestId = requestAnimationFrame(update);
|
|
200
|
+
};
|
|
201
|
+
this.tileRequestId = requestAnimationFrame(update);
|
|
146
202
|
}
|
|
147
|
-
// TODO
|
|
148
|
-
// if (hiddenNodeIds) {
|
|
149
|
-
// hiddenNodeIds.forEach((id) => {
|
|
150
|
-
// graph.drawTransient('node', id, { action: 'remove' });
|
|
151
|
-
// });
|
|
152
|
-
// graph.showItem(hiddenNodeIds, false);
|
|
153
|
-
// }
|
|
154
203
|
}
|
|
155
204
|
this.hiddenEdgeIds = [];
|
|
156
205
|
this.hiddenNodeIds = [];
|
|
@@ -182,21 +231,43 @@ export class ZoomCanvas extends Behavior {
|
|
|
182
231
|
|
|
183
232
|
// begin zooming
|
|
184
233
|
if (!this.zooming) {
|
|
234
|
+
this.graph.canvas.getConfig().disableHitTesting = true;
|
|
185
235
|
this.hideShapes();
|
|
186
236
|
this.zooming = true;
|
|
187
237
|
}
|
|
238
|
+
|
|
239
|
+
const { tileBehavior: graphBehaviorOptimize } =
|
|
240
|
+
graph.getSpecification().optimize || {};
|
|
241
|
+
|
|
242
|
+
const shouldDebounce =
|
|
243
|
+
typeof graphBehaviorOptimize === 'boolean'
|
|
244
|
+
? graphBehaviorOptimize
|
|
245
|
+
: graph.getAllNodesData().length < graphBehaviorOptimize;
|
|
246
|
+
|
|
247
|
+
const now = Date.now();
|
|
248
|
+
if (
|
|
249
|
+
shouldDebounce &&
|
|
250
|
+
this.lastWheelTriggerTime &&
|
|
251
|
+
now - this.lastWheelTriggerTime < WHEEL_DURATION / 5
|
|
252
|
+
) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
188
256
|
let zoomRatio = 1;
|
|
189
257
|
if (deltaY < 0) zoomRatio = (100 + sensitivity) / 100;
|
|
190
258
|
if (deltaY > 0) zoomRatio = 100 / (100 + sensitivity);
|
|
191
259
|
const zoomTo = zoomRatio * graph.getZoom();
|
|
192
260
|
if (minZoom && zoomTo < minZoom) return;
|
|
193
261
|
if (maxZoom && zoomTo > maxZoom) return;
|
|
194
|
-
|
|
262
|
+
|
|
195
263
|
graph.zoom(zoomRatio, { x: client.x, y: client.y });
|
|
196
264
|
|
|
265
|
+
this.lastWheelTriggerTime = now;
|
|
266
|
+
|
|
197
267
|
clearTimeout(this.zoomTimer);
|
|
198
268
|
this.zoomTimer = setTimeout(() => {
|
|
199
269
|
this.endZoom();
|
|
270
|
+
this.graph.canvas.getConfig().disableHitTesting = false;
|
|
200
271
|
}, 300);
|
|
201
272
|
|
|
202
273
|
// Emit event.
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
/**
|
|
10
10
|
* Validate and format the graph data.
|
|
11
11
|
* @param data input user data.
|
|
12
|
-
* @param
|
|
12
|
+
* @param graphCore the graph core stores the previous data.
|
|
13
13
|
* @returns formatted data.
|
|
14
14
|
*/
|
|
15
15
|
export const MapNodeSize = (
|
|
@@ -18,7 +18,7 @@ export const MapNodeSize = (
|
|
|
18
18
|
field?: string;
|
|
19
19
|
range?: [number, number];
|
|
20
20
|
} = {},
|
|
21
|
-
|
|
21
|
+
graphCore?: GraphCore,
|
|
22
22
|
): GraphData => {
|
|
23
23
|
const { field, range = [8, 40] } = options;
|
|
24
24
|
if (!field) return data;
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
/**
|
|
11
11
|
* Validate and format the graph data.
|
|
12
12
|
* @param data input user data.
|
|
13
|
-
* @param
|
|
13
|
+
* @param graphCore the graph core stores the previous data.
|
|
14
14
|
* @returns formatted data.
|
|
15
15
|
*/
|
|
16
16
|
export const TransformV4Data = (
|
|
17
17
|
data: GraphData,
|
|
18
18
|
options = {},
|
|
19
|
-
|
|
19
|
+
graphCore?: GraphCore,
|
|
20
20
|
): GraphData => {
|
|
21
21
|
const { nodes = [], edges = [], combos = [] } = data;
|
|
22
22
|
const formattedNodes = nodes.map((node: any) => {
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
/**
|
|
11
11
|
* Validate and format the graph data.
|
|
12
12
|
* @param data input user data.
|
|
13
|
-
* @param
|
|
13
|
+
* @param graphCore the graph core stores the previous data.
|
|
14
14
|
* @returns formatted data.
|
|
15
15
|
*/
|
|
16
16
|
export const ValidateData = (
|
|
17
17
|
data: GraphData,
|
|
18
18
|
options = {},
|
|
19
|
-
|
|
19
|
+
graphCore?: GraphCore,
|
|
20
20
|
): GraphData => {
|
|
21
21
|
const { nodes, edges, combos } = data;
|
|
22
22
|
const idMap = new Map();
|
|
@@ -27,14 +27,14 @@ export const ValidateData = (
|
|
|
27
27
|
if (item.id === undefined) {
|
|
28
28
|
if (generateId) {
|
|
29
29
|
item.id = `${type}-${uniqueId()}`;
|
|
30
|
-
|
|
30
|
+
} else {
|
|
31
|
+
console.error(
|
|
32
|
+
`Unique global id is neccessary for graph items. The ${type} ${JSON.stringify(
|
|
33
|
+
item,
|
|
34
|
+
)} without id will be ignored.`,
|
|
35
|
+
);
|
|
36
|
+
return false;
|
|
31
37
|
}
|
|
32
|
-
console.error(
|
|
33
|
-
`Unique global id is neccessary for graph items. The ${type} ${JSON.stringify(
|
|
34
|
-
item,
|
|
35
|
-
)} without id will be ignored.`,
|
|
36
|
-
);
|
|
37
|
-
return false;
|
|
38
38
|
}
|
|
39
39
|
if (idMap.has(item.id)) {
|
|
40
40
|
console.error(
|
|
@@ -64,7 +64,7 @@ export const ValidateData = (
|
|
|
64
64
|
if (
|
|
65
65
|
parentId !== undefined &&
|
|
66
66
|
!comboIdMap.has(parentId) &&
|
|
67
|
-
(!
|
|
67
|
+
(!graphCore || !graphCore.hasNode(parentId))
|
|
68
68
|
) {
|
|
69
69
|
console.error(
|
|
70
70
|
`The parentId of combo with id ${combo.id} will be removed since it is not exist in combos.`,
|
|
@@ -80,9 +80,9 @@ export const ValidateData = (
|
|
|
80
80
|
if (
|
|
81
81
|
parentId !== undefined &&
|
|
82
82
|
!comboIdMap.has(parentId) &&
|
|
83
|
-
(!
|
|
83
|
+
(!graphCore || !graphCore.hasNode(parentId))
|
|
84
84
|
) {
|
|
85
|
-
// TODO: parentId is a node in
|
|
85
|
+
// TODO: parentId is a node in graphCore
|
|
86
86
|
console.error(
|
|
87
87
|
`The parentId of node with id ${node.id} will be removed since it is not exist in combos.`,
|
|
88
88
|
);
|
|
@@ -100,8 +100,8 @@ export const ValidateData = (
|
|
|
100
100
|
let { source, target } = edge;
|
|
101
101
|
if (!idAndDataCheck(edge, 'edge', true)) return false;
|
|
102
102
|
|
|
103
|
-
if (
|
|
104
|
-
const existEdge =
|
|
103
|
+
if (graphCore?.hasEdge(id)) {
|
|
104
|
+
const existEdge = graphCore?.getEdge(id);
|
|
105
105
|
if (source === undefined) source = existEdge.source;
|
|
106
106
|
if (target === undefined) target = existEdge.target;
|
|
107
107
|
}
|
|
@@ -121,7 +121,7 @@ export const ValidateData = (
|
|
|
121
121
|
if (
|
|
122
122
|
!nodeIdMap.has(source) &&
|
|
123
123
|
!comboIdMap.has(source) &&
|
|
124
|
-
(!
|
|
124
|
+
(!graphCore || !graphCore.hasNode(source))
|
|
125
125
|
) {
|
|
126
126
|
console.error(
|
|
127
127
|
`The edge with id ${id} will be ignored since its source ${source} is not existed in nodes and combos.`,
|
|
@@ -131,7 +131,7 @@ export const ValidateData = (
|
|
|
131
131
|
if (
|
|
132
132
|
!nodeIdMap.has(target) &&
|
|
133
133
|
!comboIdMap.has(target) &&
|
|
134
|
-
(!
|
|
134
|
+
(!graphCore || !graphCore.hasNode(target))
|
|
135
135
|
) {
|
|
136
136
|
console.error(
|
|
137
137
|
`The edge with id ${id} will be ignored since its target ${target} is not existed in nodes and combos.`,
|
package/src/stdlib/index.ts
CHANGED
|
@@ -31,6 +31,10 @@ const {
|
|
|
31
31
|
TriangleNode,
|
|
32
32
|
EllipseNode,
|
|
33
33
|
ModelRectNode,
|
|
34
|
+
ImageNode,
|
|
35
|
+
CubeNode,
|
|
36
|
+
BaseNode,
|
|
37
|
+
BaseNode3D,
|
|
34
38
|
} = Nodes;
|
|
35
39
|
|
|
36
40
|
const {
|
|
@@ -60,6 +64,9 @@ const {
|
|
|
60
64
|
DragNode,
|
|
61
65
|
DragCombo,
|
|
62
66
|
ClickSelect,
|
|
67
|
+
CreateEdge,
|
|
68
|
+
ShortcutsCall,
|
|
69
|
+
ScrollCanvas,
|
|
63
70
|
} = Behaviors;
|
|
64
71
|
const {
|
|
65
72
|
History,
|
|
@@ -71,6 +78,8 @@ const {
|
|
|
71
78
|
Legend,
|
|
72
79
|
Toolbar,
|
|
73
80
|
Timebar,
|
|
81
|
+
Snapline,
|
|
82
|
+
EdgeFilterLens,
|
|
74
83
|
} = Plugins;
|
|
75
84
|
|
|
76
85
|
const {
|
|
@@ -91,6 +100,7 @@ const {
|
|
|
91
100
|
import lassoSelector from './selector/lasso';
|
|
92
101
|
import rectSelector from './selector/rect';
|
|
93
102
|
import Hull from './plugin/hull';
|
|
103
|
+
import { WaterMarker } from './plugin/watermaker';
|
|
94
104
|
|
|
95
105
|
const stdLib = {
|
|
96
106
|
transforms: {
|
|
@@ -128,9 +138,11 @@ const stdLib = {
|
|
|
128
138
|
nodes: {
|
|
129
139
|
'circle-node': CircleNode,
|
|
130
140
|
'rect-node': RectNode,
|
|
141
|
+
'image-node': ImageNode,
|
|
131
142
|
},
|
|
132
143
|
edges: {
|
|
133
144
|
'line-edge': LineEdge,
|
|
145
|
+
'loop-edge': LoopEdge,
|
|
134
146
|
},
|
|
135
147
|
combos: {
|
|
136
148
|
'circle-combo': CircleCombo,
|
|
@@ -203,13 +215,13 @@ const Extensions = {
|
|
|
203
215
|
ValidateData,
|
|
204
216
|
TransformV4Data,
|
|
205
217
|
MapNodeSize,
|
|
206
|
-
//themes
|
|
218
|
+
// themes
|
|
207
219
|
LightTheme,
|
|
208
220
|
DarkTheme,
|
|
209
|
-
//themeSolvers
|
|
221
|
+
// themeSolvers
|
|
210
222
|
SpecThemeSolver,
|
|
211
223
|
SubjectThemeSolver,
|
|
212
|
-
//layout
|
|
224
|
+
// layout
|
|
213
225
|
ForceLayout,
|
|
214
226
|
GridLayout,
|
|
215
227
|
CircularLayout,
|
|
@@ -222,12 +234,12 @@ const Extensions = {
|
|
|
222
234
|
ForceAtlas2Layout,
|
|
223
235
|
DagreLayout,
|
|
224
236
|
ComboCombinedLayout,
|
|
225
|
-
//Hierarchy
|
|
237
|
+
// Hierarchy
|
|
226
238
|
compactBox,
|
|
227
239
|
dendrogram,
|
|
228
240
|
indented,
|
|
229
241
|
mindmap,
|
|
230
|
-
//nodes
|
|
242
|
+
// nodes
|
|
231
243
|
CircleNode,
|
|
232
244
|
RectNode,
|
|
233
245
|
DiamondNode,
|
|
@@ -238,6 +250,9 @@ const Extensions = {
|
|
|
238
250
|
TriangleNode,
|
|
239
251
|
EllipseNode,
|
|
240
252
|
ModelRectNode,
|
|
253
|
+
CubeNode,
|
|
254
|
+
BaseNode,
|
|
255
|
+
BaseNode3D,
|
|
241
256
|
// edges
|
|
242
257
|
LineEdge,
|
|
243
258
|
CubicEdge,
|
|
@@ -249,7 +264,7 @@ const Extensions = {
|
|
|
249
264
|
// combos
|
|
250
265
|
CircleCombo,
|
|
251
266
|
RectCombo,
|
|
252
|
-
//behaviors
|
|
267
|
+
// behaviors
|
|
253
268
|
BaseBehavior,
|
|
254
269
|
ActivateRelations,
|
|
255
270
|
BrushSelect,
|
|
@@ -265,7 +280,10 @@ const Extensions = {
|
|
|
265
280
|
CollapseExpandCombo,
|
|
266
281
|
DragNode,
|
|
267
282
|
DragCombo,
|
|
268
|
-
|
|
283
|
+
CreateEdge,
|
|
284
|
+
ShortcutsCall,
|
|
285
|
+
ScrollCanvas,
|
|
286
|
+
// plugins
|
|
269
287
|
BasePlugin,
|
|
270
288
|
History,
|
|
271
289
|
Toolbar,
|
|
@@ -277,6 +295,9 @@ const Extensions = {
|
|
|
277
295
|
Legend,
|
|
278
296
|
Timebar,
|
|
279
297
|
Hull,
|
|
298
|
+
Snapline,
|
|
299
|
+
EdgeFilterLens,
|
|
300
|
+
WaterMarker,
|
|
280
301
|
};
|
|
281
302
|
|
|
282
303
|
export default registery;
|
|
@@ -21,12 +21,7 @@ import {
|
|
|
21
21
|
State,
|
|
22
22
|
LodStrategyObj,
|
|
23
23
|
} from '../../../types/item';
|
|
24
|
-
import {
|
|
25
|
-
LOCAL_BOUNDS_DIRTY_FLAG_KEY,
|
|
26
|
-
formatPadding,
|
|
27
|
-
mergeStyles,
|
|
28
|
-
upsertShape,
|
|
29
|
-
} from '../../../util/shape';
|
|
24
|
+
import { formatPadding, mergeStyles, upsertShape } from '../../../util/shape';
|
|
30
25
|
import { DEFAULT_ANIMATE_CFG, fadeIn, fadeOut } from '../../../util/animate';
|
|
31
26
|
import { getWordWrapWidthByEnds } from '../../../util/text';
|
|
32
27
|
import { AnimateCfg } from '../../../types/animate';
|
|
@@ -49,9 +44,7 @@ export abstract class BaseEdge {
|
|
|
49
44
|
transform: string;
|
|
50
45
|
isRevert: boolean;
|
|
51
46
|
};
|
|
52
|
-
|
|
53
|
-
labelShapeGeometry?: AABB;
|
|
54
|
-
labelBackgroundShapeGeometry?: AABB;
|
|
47
|
+
transformCache: {
|
|
55
48
|
labelShapeTransform?: string;
|
|
56
49
|
labelBackgroundShapeTransform?: string;
|
|
57
50
|
};
|
|
@@ -89,7 +82,7 @@ export abstract class BaseEdge {
|
|
|
89
82
|
const { themeStyles, lodStrategy, zoom } = props;
|
|
90
83
|
if (themeStyles) this.themeStyles = themeStyles;
|
|
91
84
|
this.lodStrategy = lodStrategy;
|
|
92
|
-
this.
|
|
85
|
+
this.transformCache = {};
|
|
93
86
|
this.zoomCache.zoom = zoom;
|
|
94
87
|
this.zoomCache.balanceRatio = 1 / zoom;
|
|
95
88
|
this.zoomCache.animateConfig = {
|
|
@@ -147,10 +140,8 @@ export abstract class BaseEdge {
|
|
|
147
140
|
public updateCache(shapeMap) {
|
|
148
141
|
['labelShape', 'labelBackgroundShape'].forEach((id) => {
|
|
149
142
|
const shape = shapeMap[id];
|
|
150
|
-
if (shape
|
|
151
|
-
this.
|
|
152
|
-
this.boundsCache[`${id}Transform`] = shape.style.transform;
|
|
153
|
-
shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, false);
|
|
143
|
+
if (shape) {
|
|
144
|
+
this.transformCache[`${id}Transform`] = shape.style.transform;
|
|
154
145
|
}
|
|
155
146
|
});
|
|
156
147
|
|
|
@@ -262,7 +253,7 @@ export abstract class BaseEdge {
|
|
|
262
253
|
offsetY: 0,
|
|
263
254
|
pointRatio: [0.5, 0.501],
|
|
264
255
|
};
|
|
265
|
-
if (
|
|
256
|
+
if (typeof position === 'number') {
|
|
266
257
|
positionPreset.pointRatio = [position, position + 0.01];
|
|
267
258
|
}
|
|
268
259
|
switch (position) {
|
|
@@ -289,9 +280,10 @@ export abstract class BaseEdge {
|
|
|
289
280
|
const pointOffset = (keyShape as Line | Polyline).getPoint(
|
|
290
281
|
positionPreset.pointRatio[1],
|
|
291
282
|
);
|
|
292
|
-
|
|
283
|
+
let angle = Math.atan(
|
|
293
284
|
(point.y - pointOffset.y) / (point.x - pointOffset.x),
|
|
294
|
-
);
|
|
285
|
+
);
|
|
286
|
+
if (isNaN(angle)) angle = 0;
|
|
295
287
|
|
|
296
288
|
// revert
|
|
297
289
|
isRevert = pointOffset.x < point.x;
|
|
@@ -331,6 +323,7 @@ export abstract class BaseEdge {
|
|
|
331
323
|
maxWidth,
|
|
332
324
|
this.zoomCache.zoom,
|
|
333
325
|
);
|
|
326
|
+
this.zoomCache.wordWrapWidth = wordWrapWidth;
|
|
334
327
|
const style = {
|
|
335
328
|
...this.defaultStyles.labelShape,
|
|
336
329
|
textAlign: positionPreset.textAlign,
|
|
@@ -339,6 +332,7 @@ export abstract class BaseEdge {
|
|
|
339
332
|
...positionStyle,
|
|
340
333
|
...otherStyle,
|
|
341
334
|
};
|
|
335
|
+
this.transformCache.labelShapeTransform = style.transform;
|
|
342
336
|
return this.upsertShape('text', 'labelShape', style, shapeMap, model);
|
|
343
337
|
}
|
|
344
338
|
|
|
@@ -362,8 +356,7 @@ export abstract class BaseEdge {
|
|
|
362
356
|
const { labelBackgroundShape, labelShape: labelShapeStyle } =
|
|
363
357
|
this.mergedStyles;
|
|
364
358
|
|
|
365
|
-
const textBBox =
|
|
366
|
-
this.boundsCache.labelShapeGeometry || labelShape.getGeometryBounds();
|
|
359
|
+
const textBBox = labelShape.getGeometryBounds();
|
|
367
360
|
const { x, y, transform, isRevert } = this.labelPosition;
|
|
368
361
|
const { padding, ...backgroundStyle } = labelBackgroundShape;
|
|
369
362
|
const { balanceRatio = 1 } = this.zoomCache;
|
|
@@ -448,15 +441,9 @@ export abstract class BaseEdge {
|
|
|
448
441
|
shapeStyle.height = h;
|
|
449
442
|
}
|
|
450
443
|
|
|
451
|
-
if (labelShape) {
|
|
452
|
-
const referShape = labelBackgroundShape || labelShape;
|
|
453
|
-
}
|
|
454
444
|
if (labelShapeProps) {
|
|
455
445
|
const referShape = labelBackgroundShape || labelShape;
|
|
456
|
-
const referBounds =
|
|
457
|
-
this.boundsCache.labelBackgroundShapeGeometry ||
|
|
458
|
-
this.boundsCache.labelShapeGeometry ||
|
|
459
|
-
referShape.getGeometryBounds();
|
|
446
|
+
const referBounds = referShape.getGeometryBounds();
|
|
460
447
|
const {
|
|
461
448
|
min: referMin,
|
|
462
449
|
max: referMax,
|
|
@@ -550,7 +537,11 @@ export abstract class BaseEdge {
|
|
|
550
537
|
* @param shapeMap The shape map that contains all of the elements to show on the edge.
|
|
551
538
|
* @param zoom The zoom level of the graph.
|
|
552
539
|
*/
|
|
553
|
-
public onZoom = (
|
|
540
|
+
public onZoom = (
|
|
541
|
+
shapeMap: EdgeShapeMap,
|
|
542
|
+
zoom: number,
|
|
543
|
+
cacheHiddenShape = {},
|
|
544
|
+
) => {
|
|
554
545
|
// balance the size for label, badges
|
|
555
546
|
this.balanceShapeSize(shapeMap, zoom);
|
|
556
547
|
|
|
@@ -574,7 +565,10 @@ export abstract class BaseEdge {
|
|
|
574
565
|
// zoomLevel changed, from higher to lower, hide something
|
|
575
566
|
if (firstRender) {
|
|
576
567
|
for (let i = currentLevel + 1; i <= maxLevel; i++) {
|
|
577
|
-
levelShapes[String(i)]?.forEach((id) =>
|
|
568
|
+
levelShapes[String(i)]?.forEach((id) => {
|
|
569
|
+
if (!shapeMap[id] || cacheHiddenShape[id]) return;
|
|
570
|
+
shapeMap[id]?.hide();
|
|
571
|
+
});
|
|
578
572
|
}
|
|
579
573
|
} else {
|
|
580
574
|
for (let i = currentLevel + 1; i <= maxLevel; i++) {
|
|
@@ -586,7 +580,8 @@ export abstract class BaseEdge {
|
|
|
586
580
|
} else if (currentLevel > previousLevel) {
|
|
587
581
|
// zoomLevel changed, from lower to higher, show something
|
|
588
582
|
for (let i = currentLevel; i >= minLevel; i--) {
|
|
589
|
-
levelShapes[String(i)]?.forEach((id) =>
|
|
583
|
+
levelShapes[String(i)]?.forEach((id) => {
|
|
584
|
+
if (hiddenShape[id]) return;
|
|
590
585
|
fadeIn(
|
|
591
586
|
id,
|
|
592
587
|
shapeMap[id],
|
|
@@ -594,8 +589,8 @@ export abstract class BaseEdge {
|
|
|
594
589
|
this.mergedStyles[id.replace('Background', '')],
|
|
595
590
|
hiddenShape,
|
|
596
591
|
animateConfig,
|
|
597
|
-
)
|
|
598
|
-
);
|
|
592
|
+
);
|
|
593
|
+
});
|
|
599
594
|
}
|
|
600
595
|
}
|
|
601
596
|
|
|
@@ -621,7 +616,7 @@ export abstract class BaseEdge {
|
|
|
621
616
|
if (position === 'bottom') labelShape.style.transformOrigin = '0';
|
|
622
617
|
else labelShape.style.transformOrigin = '';
|
|
623
618
|
|
|
624
|
-
const oriTransform = this.
|
|
619
|
+
const oriTransform = this.transformCache.labelShapeTransform;
|
|
625
620
|
labelShape.style.transform = `${oriTransform} scale(${balanceRatio}, ${balanceRatio})`;
|
|
626
621
|
|
|
627
622
|
const wordWrapWidth = this.zoomCache.wordWrapWidth * zoom;
|
|
@@ -629,7 +624,7 @@ export abstract class BaseEdge {
|
|
|
629
624
|
|
|
630
625
|
if (!labelBackgroundShape) return;
|
|
631
626
|
|
|
632
|
-
const oriBgTransform = this.
|
|
627
|
+
const oriBgTransform = this.transformCache.labelBackgroundShapeTransform;
|
|
633
628
|
labelBackgroundShape.style.transform = `${oriBgTransform} scale(${balanceRatio}, ${balanceRatio})`;
|
|
634
629
|
}
|
|
635
630
|
|
|
@@ -678,12 +673,9 @@ export abstract class BaseEdge {
|
|
|
678
673
|
resultStyle[`${markerField}Offset`] = 0;
|
|
679
674
|
return;
|
|
680
675
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
} else {
|
|
685
|
-
arrowStyle = arrowConfig;
|
|
686
|
-
}
|
|
676
|
+
const arrowStyle = isBoolean(arrowConfig)
|
|
677
|
+
? ({ ...DEFAULT_ARROW_CONFIG } as ArrowStyle)
|
|
678
|
+
: arrowConfig;
|
|
687
679
|
const {
|
|
688
680
|
type = 'triangle',
|
|
689
681
|
width = 10,
|
|
@@ -692,14 +684,13 @@ export abstract class BaseEdge {
|
|
|
692
684
|
offset = 0,
|
|
693
685
|
...others
|
|
694
686
|
} = arrowStyle;
|
|
695
|
-
const path = propPath ? propPath : getArrowPath(type, width, height);
|
|
696
687
|
resultStyle[markerField] = this.upsertShape(
|
|
697
688
|
'path',
|
|
698
689
|
`${markerField}Shape`,
|
|
699
690
|
{
|
|
700
691
|
...bodyStyle,
|
|
701
692
|
fill: type === 'simple' ? '' : bodyStyle.stroke,
|
|
702
|
-
path,
|
|
693
|
+
path: propPath || getArrowPath(type, width, height),
|
|
703
694
|
anchor: '0.5 0.5',
|
|
704
695
|
transformOrigin: 'center',
|
|
705
696
|
...others,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DisplayObject } from '@antv/g';
|
|
2
|
-
import { vec2 } from '
|
|
2
|
+
import { vec2 } from 'gl-matrix';
|
|
3
3
|
import { Point } from '../../../types/common';
|
|
4
4
|
import { EdgeModelData, EdgeShapeMap } from '../../../types/edge';
|
|
5
5
|
import { State } from '../../../types/item';
|