@antv/g6 5.0.0-beta.2 → 5.0.0-beta.21
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 +33 -65
- 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 +30 -16
- package/esm/runtime/controller/data.js +290 -422
- 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.js +2 -2
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.d.ts +7 -1
- 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.js +1 -1
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/create-edge.d.ts +57 -0
- package/esm/stdlib/behavior/create-edge.js +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 +2 -2
- package/esm/stdlib/behavior/drag-combo.js +43 -32
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.d.ts +3 -3
- package/esm/stdlib/behavior/drag-node.js +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/index.d.ts +1 -0
- package/esm/stdlib/data/index.js +1 -0
- package/esm/stdlib/data/index.js.map +1 -1
- package/esm/stdlib/data/mapNodeSize.d.ts +4 -5
- package/esm/stdlib/data/mapNodeSize.js +12 -2
- package/esm/stdlib/data/mapNodeSize.js.map +1 -1
- package/esm/stdlib/data/processParallelEdges.d.ts +21 -0
- package/esm/stdlib/data/processParallelEdges.js +127 -0
- package/esm/stdlib/data/processParallelEdges.js.map +1 -0
- package/esm/stdlib/data/transformV4Data.d.ts +3 -4
- package/esm/stdlib/data/transformV4Data.js +10 -2
- package/esm/stdlib/data/transformV4Data.js.map +1 -1
- package/esm/stdlib/data/validateData.d.ts +4 -5
- package/esm/stdlib/data/validateData.js +22 -13
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +27 -8
- package/esm/stdlib/index.js +24 -11
- 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/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 +1 -1
- 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 +2 -2
- 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.js +2 -2
- 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 +4 -4
- 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/data.d.ts +5 -0
- package/esm/types/event.d.ts +1 -0
- package/esm/types/graph.d.ts +48 -22
- package/esm/types/hook.d.ts +22 -2
- package/esm/types/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 +7 -1
- package/esm/types/item.js.map +1 -1
- package/esm/types/plugin.d.ts +1 -1
- package/esm/types/spec.d.ts +20 -3
- package/esm/types/view.d.ts +5 -0
- package/esm/util/array.d.ts +1 -0
- package/esm/util/array.js +3 -0
- package/esm/util/array.js.map +1 -1
- 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 +5 -2
- package/esm/util/data.js +15 -0
- 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 +3 -1
- 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 +12 -1
- package/esm/util/layout.js +45 -0
- package/esm/util/layout.js.map +1 -1
- package/esm/util/loop.d.ts +2 -1
- package/esm/util/loop.js +14 -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 +3 -3
- package/esm/util/shape.js +17 -26
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.d.ts +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 +33 -65
- 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 +30 -16
- package/lib/runtime/controller/data.js +288 -420
- 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.js +2 -2
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.d.ts +7 -1
- 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.js +1 -1
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/create-edge.d.ts +57 -0
- package/lib/stdlib/behavior/create-edge.js +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 +2 -2
- package/lib/stdlib/behavior/drag-combo.js +43 -32
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.d.ts +3 -3
- package/lib/stdlib/behavior/drag-node.js +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/index.d.ts +1 -0
- package/lib/stdlib/data/index.js +1 -0
- package/lib/stdlib/data/index.js.map +1 -1
- package/lib/stdlib/data/mapNodeSize.d.ts +4 -5
- package/lib/stdlib/data/mapNodeSize.js +13 -3
- package/lib/stdlib/data/mapNodeSize.js.map +1 -1
- package/lib/stdlib/data/processParallelEdges.d.ts +21 -0
- package/lib/stdlib/data/processParallelEdges.js +131 -0
- package/lib/stdlib/data/processParallelEdges.js.map +1 -0
- package/lib/stdlib/data/transformV4Data.d.ts +3 -4
- package/lib/stdlib/data/transformV4Data.js +11 -3
- package/lib/stdlib/data/transformV4Data.js.map +1 -1
- package/lib/stdlib/data/validateData.d.ts +4 -5
- package/lib/stdlib/data/validateData.js +23 -14
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +27 -8
- package/lib/stdlib/index.js +24 -11
- 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/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 +1 -1
- 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 +2 -2
- 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.js +2 -2
- 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 +4 -4
- 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/data.d.ts +5 -0
- package/lib/types/event.d.ts +1 -0
- package/lib/types/graph.d.ts +48 -22
- package/lib/types/hook.d.ts +22 -2
- package/lib/types/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 +7 -1
- package/lib/types/item.js.map +1 -1
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/spec.d.ts +20 -3
- package/lib/types/view.d.ts +5 -0
- package/lib/util/array.d.ts +1 -0
- package/lib/util/array.js +5 -1
- package/lib/util/array.js.map +1 -1
- 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 +5 -2
- package/lib/util/data.js +16 -1
- 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 +3 -1
- 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 +12 -1
- package/lib/util/layout.js +47 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/loop.d.ts +2 -1
- package/lib/util/loop.js +15 -1
- 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 +3 -3
- package/lib/util/shape.js +17 -26
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.d.ts +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 +42 -51
- 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 +371 -490
- 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/index.ts +1 -0
- package/src/stdlib/data/mapNodeSize.ts +22 -3
- package/src/stdlib/data/processParallelEdges.ts +203 -0
- package/src/stdlib/data/transformV4Data.ts +16 -3
- package/src/stdlib/data/validateData.ts +32 -18
- package/src/stdlib/index.ts +31 -8
- 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/data.ts +6 -0
- 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 +12 -1
- package/src/types/plugin.ts +1 -1
- package/src/types/spec.ts +23 -3
- package/src/types/view.ts +8 -3
- package/src/util/array.ts +12 -0
- package/src/util/bbox.ts +42 -6
- package/src/util/behavior.ts +4 -4
- package/src/util/data.ts +26 -4
- 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 +16 -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 +23 -26
- package/src/util/shape3d.ts +20 -20
- package/src/util/text.ts +3 -1
- package/src/util/warn.ts +20 -0
package/src/stdlib/index.ts
CHANGED
|
@@ -13,7 +13,8 @@ import * as Themes from './theme';
|
|
|
13
13
|
import * as ThemeSolvers from './themeSolver';
|
|
14
14
|
import * as Plugins from './plugin';
|
|
15
15
|
|
|
16
|
-
const { ValidateData, TransformV4Data, MapNodeSize } =
|
|
16
|
+
const { ValidateData, TransformV4Data, MapNodeSize, ProcessParallelEdges } =
|
|
17
|
+
Transforms;
|
|
17
18
|
|
|
18
19
|
const { compactBox, dendrogram, indented, mindmap } = Hierarchy;
|
|
19
20
|
|
|
@@ -31,6 +32,10 @@ const {
|
|
|
31
32
|
TriangleNode,
|
|
32
33
|
EllipseNode,
|
|
33
34
|
ModelRectNode,
|
|
35
|
+
ImageNode,
|
|
36
|
+
CubeNode,
|
|
37
|
+
BaseNode,
|
|
38
|
+
BaseNode3D,
|
|
34
39
|
} = Nodes;
|
|
35
40
|
|
|
36
41
|
const {
|
|
@@ -60,6 +65,9 @@ const {
|
|
|
60
65
|
DragNode,
|
|
61
66
|
DragCombo,
|
|
62
67
|
ClickSelect,
|
|
68
|
+
CreateEdge,
|
|
69
|
+
ShortcutsCall,
|
|
70
|
+
ScrollCanvas,
|
|
63
71
|
} = Behaviors;
|
|
64
72
|
const {
|
|
65
73
|
History,
|
|
@@ -71,6 +79,8 @@ const {
|
|
|
71
79
|
Legend,
|
|
72
80
|
Toolbar,
|
|
73
81
|
Timebar,
|
|
82
|
+
Snapline,
|
|
83
|
+
EdgeFilterLens,
|
|
74
84
|
} = Plugins;
|
|
75
85
|
|
|
76
86
|
const {
|
|
@@ -91,6 +101,7 @@ const {
|
|
|
91
101
|
import lassoSelector from './selector/lasso';
|
|
92
102
|
import rectSelector from './selector/rect';
|
|
93
103
|
import Hull from './plugin/hull';
|
|
104
|
+
import { WaterMarker } from './plugin/watermaker';
|
|
94
105
|
|
|
95
106
|
const stdLib = {
|
|
96
107
|
transforms: {
|
|
@@ -128,9 +139,11 @@ const stdLib = {
|
|
|
128
139
|
nodes: {
|
|
129
140
|
'circle-node': CircleNode,
|
|
130
141
|
'rect-node': RectNode,
|
|
142
|
+
'image-node': ImageNode,
|
|
131
143
|
},
|
|
132
144
|
edges: {
|
|
133
145
|
'line-edge': LineEdge,
|
|
146
|
+
'loop-edge': LoopEdge,
|
|
134
147
|
},
|
|
135
148
|
combos: {
|
|
136
149
|
'circle-combo': CircleCombo,
|
|
@@ -203,13 +216,14 @@ const Extensions = {
|
|
|
203
216
|
ValidateData,
|
|
204
217
|
TransformV4Data,
|
|
205
218
|
MapNodeSize,
|
|
206
|
-
|
|
219
|
+
ProcessParallelEdges,
|
|
220
|
+
// themes
|
|
207
221
|
LightTheme,
|
|
208
222
|
DarkTheme,
|
|
209
|
-
//themeSolvers
|
|
223
|
+
// themeSolvers
|
|
210
224
|
SpecThemeSolver,
|
|
211
225
|
SubjectThemeSolver,
|
|
212
|
-
//layout
|
|
226
|
+
// layout
|
|
213
227
|
ForceLayout,
|
|
214
228
|
GridLayout,
|
|
215
229
|
CircularLayout,
|
|
@@ -222,12 +236,12 @@ const Extensions = {
|
|
|
222
236
|
ForceAtlas2Layout,
|
|
223
237
|
DagreLayout,
|
|
224
238
|
ComboCombinedLayout,
|
|
225
|
-
//Hierarchy
|
|
239
|
+
// Hierarchy
|
|
226
240
|
compactBox,
|
|
227
241
|
dendrogram,
|
|
228
242
|
indented,
|
|
229
243
|
mindmap,
|
|
230
|
-
//nodes
|
|
244
|
+
// nodes
|
|
231
245
|
CircleNode,
|
|
232
246
|
RectNode,
|
|
233
247
|
DiamondNode,
|
|
@@ -238,6 +252,9 @@ const Extensions = {
|
|
|
238
252
|
TriangleNode,
|
|
239
253
|
EllipseNode,
|
|
240
254
|
ModelRectNode,
|
|
255
|
+
CubeNode,
|
|
256
|
+
BaseNode,
|
|
257
|
+
BaseNode3D,
|
|
241
258
|
// edges
|
|
242
259
|
LineEdge,
|
|
243
260
|
CubicEdge,
|
|
@@ -249,7 +266,7 @@ const Extensions = {
|
|
|
249
266
|
// combos
|
|
250
267
|
CircleCombo,
|
|
251
268
|
RectCombo,
|
|
252
|
-
//behaviors
|
|
269
|
+
// behaviors
|
|
253
270
|
BaseBehavior,
|
|
254
271
|
ActivateRelations,
|
|
255
272
|
BrushSelect,
|
|
@@ -265,7 +282,10 @@ const Extensions = {
|
|
|
265
282
|
CollapseExpandCombo,
|
|
266
283
|
DragNode,
|
|
267
284
|
DragCombo,
|
|
268
|
-
|
|
285
|
+
CreateEdge,
|
|
286
|
+
ShortcutsCall,
|
|
287
|
+
ScrollCanvas,
|
|
288
|
+
// plugins
|
|
269
289
|
BasePlugin,
|
|
270
290
|
History,
|
|
271
291
|
Toolbar,
|
|
@@ -277,6 +297,9 @@ const Extensions = {
|
|
|
277
297
|
Legend,
|
|
278
298
|
Timebar,
|
|
279
299
|
Hull,
|
|
300
|
+
Snapline,
|
|
301
|
+
EdgeFilterLens,
|
|
302
|
+
WaterMarker,
|
|
280
303
|
};
|
|
281
304
|
|
|
282
305
|
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';
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
ComboShapeMap,
|
|
24
24
|
} from '../../../types/combo';
|
|
25
25
|
import {
|
|
26
|
-
LOCAL_BOUNDS_DIRTY_FLAG_KEY,
|
|
27
26
|
formatPadding,
|
|
28
27
|
getShapeLocalBoundsByStyle,
|
|
29
28
|
mergeStyles,
|
|
@@ -41,10 +40,7 @@ export abstract class BaseNode {
|
|
|
41
40
|
themeStyles: NodeShapeStyles | ComboShapeStyles;
|
|
42
41
|
mergedStyles: NodeShapeStyles | ComboShapeStyles;
|
|
43
42
|
lodStrategy?: LodStrategyObj;
|
|
44
|
-
|
|
45
|
-
keyShapeLocal?: AABB;
|
|
46
|
-
labelShapeGeometry?: AABB;
|
|
47
|
-
};
|
|
43
|
+
enableBalanceShape?: boolean;
|
|
48
44
|
//vertex coordinate
|
|
49
45
|
|
|
50
46
|
/**
|
|
@@ -84,10 +80,10 @@ export abstract class BaseNode {
|
|
|
84
80
|
};
|
|
85
81
|
|
|
86
82
|
constructor(props) {
|
|
87
|
-
const { themeStyles, lodStrategy, zoom } = props;
|
|
83
|
+
const { themeStyles, lodStrategy, enableBalanceShape, zoom } = props;
|
|
88
84
|
if (themeStyles) this.themeStyles = themeStyles;
|
|
89
85
|
this.lodStrategy = lodStrategy;
|
|
90
|
-
this.
|
|
86
|
+
this.enableBalanceShape = enableBalanceShape;
|
|
91
87
|
this.zoomCache.zoom = zoom;
|
|
92
88
|
this.zoomCache.balanceRatio = 1 / zoom;
|
|
93
89
|
this.zoomCache.animateConfig = {
|
|
@@ -161,21 +157,6 @@ export abstract class BaseNode {
|
|
|
161
157
|
* @param shapeMap The shape map that contains all of the elements to show on the node.
|
|
162
158
|
*/
|
|
163
159
|
public updateCache(shapeMap) {
|
|
164
|
-
['keyShape', 'labelShape']
|
|
165
|
-
.concat(Object.keys(BadgePosition))
|
|
166
|
-
.map((pos) => `${pos}BadgeShape`)
|
|
167
|
-
.forEach((id) => {
|
|
168
|
-
const shape = shapeMap[id];
|
|
169
|
-
if (shape?.getAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY)) {
|
|
170
|
-
if (id === 'labelShape') {
|
|
171
|
-
this.boundsCache[`${id}Geometry`] = shape.getGeometryBounds();
|
|
172
|
-
} else {
|
|
173
|
-
this.boundsCache[`${id}Local`] = shape.getLocalBounds();
|
|
174
|
-
}
|
|
175
|
-
shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, false);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
|
|
179
160
|
const levelShapes = {};
|
|
180
161
|
Object.keys(shapeMap).forEach((shapeId) => {
|
|
181
162
|
const { lod } = shapeMap[shapeId].attributes;
|
|
@@ -186,10 +167,10 @@ export abstract class BaseNode {
|
|
|
186
167
|
});
|
|
187
168
|
this.zoomCache.levelShapes = levelShapes;
|
|
188
169
|
|
|
189
|
-
if (shapeMap.labelShape
|
|
170
|
+
if (shapeMap.labelShape) {
|
|
190
171
|
const { maxWidth = '200%' } = this.mergedStyles.labelShape || {};
|
|
191
172
|
this.zoomCache.wordWrapWidth = getWordWrapWidthByBox(
|
|
192
|
-
|
|
173
|
+
shapeMap.keyShape.getLocalBounds(),
|
|
193
174
|
maxWidth,
|
|
194
175
|
1,
|
|
195
176
|
);
|
|
@@ -286,12 +267,10 @@ export abstract class BaseNode {
|
|
|
286
267
|
const { labelShape: shapeStyle } = this.mergedStyles;
|
|
287
268
|
if (!shapeStyle || !shapeStyle.text || !model.data.labelShape) return;
|
|
288
269
|
const { keyShape } = shapeMap;
|
|
289
|
-
this.boundsCache.keyShapeLocal =
|
|
290
|
-
this.boundsCache.keyShapeLocal || keyShape.getLocalBounds();
|
|
291
270
|
const keyShapeBox = getShapeLocalBoundsByStyle(
|
|
292
271
|
keyShape,
|
|
293
272
|
this.mergedStyles.keyShape,
|
|
294
|
-
|
|
273
|
+
keyShape.getLocalBounds(),
|
|
295
274
|
);
|
|
296
275
|
const {
|
|
297
276
|
position,
|
|
@@ -308,6 +287,7 @@ export abstract class BaseNode {
|
|
|
308
287
|
keyShapeBox as AABB,
|
|
309
288
|
maxWidth,
|
|
310
289
|
this.zoomCache.zoom,
|
|
290
|
+
this.enableBalanceShape,
|
|
311
291
|
);
|
|
312
292
|
|
|
313
293
|
const positionPreset = {
|
|
@@ -393,15 +373,8 @@ export abstract class BaseNode {
|
|
|
393
373
|
): DisplayObject {
|
|
394
374
|
const { labelShape } = shapeMap;
|
|
395
375
|
if (!labelShape || !labelShape.style.text || !model.data.labelShape) return;
|
|
396
|
-
if (
|
|
397
|
-
!this.boundsCache.labelShapeGeometry ||
|
|
398
|
-
labelShape.getAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY)
|
|
399
|
-
) {
|
|
400
|
-
this.boundsCache.labelShapeGeometry = labelShape.getGeometryBounds();
|
|
401
|
-
labelShape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, false);
|
|
402
|
-
}
|
|
403
376
|
// label's local bounds, will take scale into acount
|
|
404
|
-
const
|
|
377
|
+
const textBBoxGeo = labelShape.getGeometryBounds();
|
|
405
378
|
const height = textBBoxGeo.max[1] - textBBoxGeo.min[1];
|
|
406
379
|
const width = Math.min(
|
|
407
380
|
textBBoxGeo.max[0] - textBBoxGeo.min[0] + 2,
|
|
@@ -548,13 +521,15 @@ export abstract class BaseNode {
|
|
|
548
521
|
(style) => style.tag === 'anchorShape',
|
|
549
522
|
);
|
|
550
523
|
if (!individualConfigs.length) return;
|
|
551
|
-
this.boundsCache.keyShapeLocal =
|
|
552
|
-
this.boundsCache.keyShapeLocal || shapeMap.keyShape.getLocalBounds();
|
|
553
524
|
const shapes = {};
|
|
554
525
|
const anchorPositionMap = this.calculateAnchorPosition(keyShapeStyle);
|
|
555
526
|
individualConfigs.forEach((config, i) => {
|
|
556
527
|
const { position, fill = keyShapeStyle.fill, ...style } = config;
|
|
557
|
-
const [cx, cy] = this.getAnchorPosition(
|
|
528
|
+
const [cx, cy] = this.getAnchorPosition(
|
|
529
|
+
position,
|
|
530
|
+
anchorPositionMap,
|
|
531
|
+
shapeMap,
|
|
532
|
+
);
|
|
558
533
|
const id = `anchorShape${i}`;
|
|
559
534
|
shapes[id] = this.upsertShape(
|
|
560
535
|
'circle',
|
|
@@ -576,13 +551,14 @@ export abstract class BaseNode {
|
|
|
576
551
|
private getAnchorPosition(
|
|
577
552
|
position: string | [number, number],
|
|
578
553
|
anchorPositionMap: IAnchorPositionMap,
|
|
554
|
+
shapeMap: NodeShapeMap | ComboShapeMap,
|
|
579
555
|
): [number, number] {
|
|
580
|
-
const keyShapeBBox =
|
|
556
|
+
const keyShapeBBox = shapeMap.keyShape.getLocalBounds();
|
|
581
557
|
const keyShapeWidth = keyShapeBBox.max[0] - keyShapeBBox.min[0];
|
|
582
558
|
const keyShapeHeight = keyShapeBBox.max[1] - keyShapeBBox.min[1];
|
|
583
559
|
const defaultPosition: [number, number] = [
|
|
584
|
-
keyShapeBBox.max[0],
|
|
585
|
-
keyShapeBBox.min[1],
|
|
560
|
+
keyShapeBBox.max[0] - keyShapeBBox.center[0],
|
|
561
|
+
keyShapeBBox.min[1] - keyShapeBBox.center[1],
|
|
586
562
|
]; //topRight
|
|
587
563
|
if (position instanceof Array) {
|
|
588
564
|
return [
|
|
@@ -645,12 +621,10 @@ export abstract class BaseNode {
|
|
|
645
621
|
(style) => style.tag === 'badgeShape',
|
|
646
622
|
);
|
|
647
623
|
if (!individualConfigs.length) return {};
|
|
648
|
-
this.boundsCache.keyShapeLocal =
|
|
649
|
-
this.boundsCache.keyShapeLocal || shapeMap.keyShape.getLocalBounds();
|
|
650
624
|
const keyShapeBBox = getShapeLocalBoundsByStyle(
|
|
651
625
|
shapeMap.keyShape,
|
|
652
626
|
keyShapeStyle,
|
|
653
|
-
|
|
627
|
+
shapeMap.keyShape.getLocalBounds(),
|
|
654
628
|
);
|
|
655
629
|
const keyShapeSize = Math.min(
|
|
656
630
|
keyShapeBBox.max[0] - keyShapeBBox.min[0],
|
|
@@ -751,16 +725,13 @@ export abstract class BaseNode {
|
|
|
751
725
|
shapeMap,
|
|
752
726
|
model,
|
|
753
727
|
);
|
|
754
|
-
|
|
755
|
-
const bbox = this.boundsCache[`${id}Local`];
|
|
728
|
+
const bbox = shapes[id].getLocalBounds();
|
|
756
729
|
|
|
757
730
|
const bgShapeId = `${position}BadgeBackgroundShape`;
|
|
758
731
|
const bgWidth =
|
|
759
732
|
(text as string).length <= 1
|
|
760
733
|
? bgHeight
|
|
761
734
|
: Math.max(bgHeight, bbox.max[0] - bbox.min[0]) + 8;
|
|
762
|
-
let bgX = isLeft ? pos.x - bgWidth : pos.x;
|
|
763
|
-
if (isCenter) bgX = pos.x - bgWidth / 2;
|
|
764
735
|
shapes[bgShapeId] = this.upsertShape(
|
|
765
736
|
'rect',
|
|
766
737
|
bgShapeId,
|
|
@@ -771,8 +742,8 @@ export abstract class BaseNode {
|
|
|
771
742
|
width: bgWidth,
|
|
772
743
|
radius: bgHeight / 2,
|
|
773
744
|
zIndex,
|
|
774
|
-
x:
|
|
775
|
-
y:
|
|
745
|
+
x: bbox.center[0] - bgWidth / 2,
|
|
746
|
+
y: bbox.center[1] - bgHeight / 2,
|
|
776
747
|
...otherStyles,
|
|
777
748
|
} as GShapeStyle,
|
|
778
749
|
shapeMap,
|
|
@@ -810,7 +781,11 @@ export abstract class BaseNode {
|
|
|
810
781
|
* @param shapeMap The shape map that contains all of the elements to show on the node.
|
|
811
782
|
* @param zoom The zoom level of the graph.
|
|
812
783
|
*/
|
|
813
|
-
public onZoom = (
|
|
784
|
+
public onZoom = (
|
|
785
|
+
shapeMap: NodeShapeMap | ComboShapeMap,
|
|
786
|
+
zoom: number,
|
|
787
|
+
cacheHiddenShape = {},
|
|
788
|
+
) => {
|
|
814
789
|
// zoomLevel changed
|
|
815
790
|
if (this.lodStrategy) {
|
|
816
791
|
const { levels } = this.lodStrategy;
|
|
@@ -831,7 +806,7 @@ export abstract class BaseNode {
|
|
|
831
806
|
// zoomLevel changed, from higher to lower, hide something
|
|
832
807
|
for (let i = currentLevel + 1; i <= maxLevel; i++) {
|
|
833
808
|
levelShapes[String(i)]?.forEach((id) => {
|
|
834
|
-
if (!shapeMap[id]) return;
|
|
809
|
+
if (!shapeMap[id] || cacheHiddenShape[id]) return;
|
|
835
810
|
shapeMap[id].hide();
|
|
836
811
|
hiddenShape[id] = true;
|
|
837
812
|
});
|
|
@@ -875,13 +850,13 @@ export abstract class BaseNode {
|
|
|
875
850
|
shapeMap: NodeShapeMap | ComboShapeMap,
|
|
876
851
|
zoom: number,
|
|
877
852
|
) {
|
|
853
|
+
if (!this.enableBalanceShape) return;
|
|
878
854
|
// balance the size for label, badges
|
|
879
855
|
const { keyShape, labelShape, labelBackgroundShape } = shapeMap;
|
|
880
856
|
const balanceRatio = 1 / zoom || 1;
|
|
881
857
|
this.zoomCache.balanceRatio = balanceRatio;
|
|
882
858
|
if (!labelShape || !labelShape.isVisible()) return;
|
|
883
|
-
const {
|
|
884
|
-
const { position = 'bottom' } = labelStyle;
|
|
859
|
+
const { position = 'bottom' } = this.mergedStyles.labelShape;
|
|
885
860
|
|
|
886
861
|
const keyShapeLocal = keyShape.getLocalBounds();
|
|
887
862
|
if (zoom < 1) {
|
|
@@ -923,21 +898,20 @@ export abstract class BaseNode {
|
|
|
923
898
|
const scaleTransform = `scale(${balanceRatio}, ${balanceRatio})`;
|
|
924
899
|
labelShape.style.transform = `${oriTransform} ${scaleTransform}`;
|
|
925
900
|
this.scaleTransformCache = scaleTransform;
|
|
926
|
-
|
|
927
|
-
labelShape.style.wordWrapWidth = wordWrapWidth;
|
|
901
|
+
labelShape.style.wordWrapWidth = this.zoomCache.wordWrapWidth * zoom;
|
|
928
902
|
|
|
929
903
|
if (!labelBackgroundShape || !labelBackgroundShape.isVisible()) return;
|
|
930
904
|
|
|
931
|
-
const
|
|
905
|
+
const [paddingTop, paddingRight, paddingBottom, paddingLeft] = this
|
|
906
|
+
.mergedStyles.labelBackgroundShape.padding as number[];
|
|
907
|
+
const sidePadding = paddingRight + paddingLeft;
|
|
932
908
|
const { width, height, x, y } = labelBackgroundShape.attributes;
|
|
933
|
-
const [paddingTop, paddingRight, paddingBottom, paddingLeft] =
|
|
934
|
-
padding as number[];
|
|
935
909
|
|
|
936
910
|
switch (position) {
|
|
937
911
|
case 'top':
|
|
938
912
|
// if it is zoom-out, do not scale the gap between keyShape and labelShape, differentiate from zoom-in by adjusting transformOrigin
|
|
939
913
|
labelBackgroundShape.style.transformOrigin = `${
|
|
940
|
-
paddingLeft + (width -
|
|
914
|
+
paddingLeft + (width - sidePadding) / 2
|
|
941
915
|
} ${zoom < 1 ? height - paddingBottom : keyShapeLocal.min[1] - y}`;
|
|
942
916
|
break;
|
|
943
917
|
case 'left':
|
|
@@ -952,7 +926,7 @@ export abstract class BaseNode {
|
|
|
952
926
|
break;
|
|
953
927
|
case 'bottom':
|
|
954
928
|
labelBackgroundShape.style.transformOrigin = `${
|
|
955
|
-
paddingLeft + (width -
|
|
929
|
+
paddingLeft + (width - sidePadding) / 2
|
|
956
930
|
} ${
|
|
957
931
|
zoom < 1
|
|
958
932
|
? paddingTop + (height - paddingTop - paddingBottom) / 2
|
|
@@ -962,14 +936,13 @@ export abstract class BaseNode {
|
|
|
962
936
|
default:
|
|
963
937
|
// center
|
|
964
938
|
labelBackgroundShape.style.transformOrigin = `${
|
|
965
|
-
paddingLeft + (width -
|
|
939
|
+
paddingLeft + (width - sidePadding) / 2
|
|
966
940
|
} ${paddingTop + (height - paddingTop - paddingBottom) / 2}`;
|
|
967
941
|
}
|
|
968
942
|
|
|
969
|
-
const
|
|
943
|
+
const labelBBox = labelShape.getGeometryBounds();
|
|
970
944
|
const labelWidth = labelBBox.max[0] - labelBBox.min[0];
|
|
971
|
-
const xAxistRatio =
|
|
972
|
-
(labelWidth * balanceRatio + paddingLeft + paddingRight) / width;
|
|
945
|
+
const xAxistRatio = (labelWidth * balanceRatio + sidePadding) / width;
|
|
973
946
|
|
|
974
947
|
labelBackgroundShape.style.transform = `scale(${xAxistRatio}, ${balanceRatio})`;
|
|
975
948
|
}
|