@antv/g6 5.0.0-beta.26 → 5.0.0-beta.28
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/LICENSE +21 -0
- package/dist/g6.min.js +2 -2
- package/esm/constant/shape.d.ts +2 -2
- package/esm/index.d.ts +6 -2
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +6 -4
- package/esm/item/combo.js +13 -4
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +12 -4
- package/esm/item/edge.js +106 -18
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +20 -10
- package/esm/item/item.js +114 -63
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +11 -4
- package/esm/item/node.js +102 -8
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +5 -1
- package/esm/runtime/controller/data.js +53 -11
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/index.d.ts +1 -1
- package/esm/runtime/controller/index.js +1 -1
- package/esm/runtime/controller/index.js.map +1 -1
- package/esm/runtime/controller/interaction.js +4 -3
- package/esm/runtime/controller/interaction.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +25 -13
- package/esm/runtime/controller/item.js +284 -116
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.d.ts +3 -0
- package/esm/runtime/controller/layout.js +176 -99
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/controller/plugin.d.ts +3 -0
- package/esm/runtime/controller/plugin.js +66 -24
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/controller/viewport.js +9 -2
- package/esm/runtime/controller/viewport.js.map +1 -1
- package/esm/runtime/graph.d.ts +75 -31
- package/esm/runtime/graph.js +320 -161
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/hooks.d.ts +2 -2
- package/esm/runtime/hooks.js +2 -2
- package/esm/stdlib/behavior/click-select.js +9 -3
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/create-edge.d.ts +1 -1
- package/esm/stdlib/behavior/drag-canvas.d.ts +1 -1
- package/esm/stdlib/behavior/drag-canvas.js +6 -3
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.js +8 -8
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.d.ts +5 -1
- package/esm/stdlib/behavior/drag-node.js +122 -28
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/hover-activate.d.ts +1 -1
- package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +1 -1
- package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +2 -2
- package/esm/stdlib/behavior/scroll-canvas.js +8 -8
- package/esm/stdlib/behavior/scroll-canvas.js.map +1 -1
- package/esm/stdlib/behavior/track-canvas-3d.d.ts +1 -1
- package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +1 -1
- package/esm/stdlib/behavior/zoom-canvas.d.ts +16 -0
- package/esm/stdlib/behavior/zoom-canvas.js +110 -8
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/mapNodeSize.js +2 -2
- package/esm/stdlib/data/mapNodeSize.js.map +1 -1
- package/esm/stdlib/data/transformV4Data.js +12 -6
- package/esm/stdlib/data/transformV4Data.js.map +1 -1
- package/esm/stdlib/data/validateData.js +2 -2
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +8 -4
- package/esm/stdlib/index.js +10 -6
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/combo/circle.js +12 -7
- package/esm/stdlib/item/combo/circle.js.map +1 -1
- package/esm/stdlib/item/combo/rect.js +12 -7
- package/esm/stdlib/item/combo/rect.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +24 -16
- package/esm/stdlib/item/edge/base.js +60 -121
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic.js +11 -6
- package/esm/stdlib/item/edge/cubic.js.map +1 -1
- package/esm/stdlib/item/edge/line.js +12 -7
- package/esm/stdlib/item/edge/line.js.map +1 -1
- package/esm/stdlib/item/edge/loop.js +6 -1
- package/esm/stdlib/item/edge/loop.js.map +1 -1
- package/esm/stdlib/item/edge/polyline.js +11 -6
- package/esm/stdlib/item/edge/polyline.js.map +1 -1
- package/esm/stdlib/item/edge/quadratic.js +11 -6
- package/esm/stdlib/item/edge/quadratic.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +26 -33
- package/esm/stdlib/item/node/base.js +98 -196
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.d.ts +11 -2
- package/esm/stdlib/item/node/base3d.js +14 -3
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/circle.js +13 -7
- package/esm/stdlib/item/node/circle.js.map +1 -1
- package/esm/stdlib/item/node/cube.d.ts +0 -2
- package/esm/stdlib/item/node/cube.js +12 -9
- package/esm/stdlib/item/node/cube.js.map +1 -1
- package/esm/stdlib/item/node/diamond.js +20 -11
- package/esm/stdlib/item/node/diamond.js.map +1 -1
- package/esm/stdlib/item/node/donut.js +18 -8
- package/esm/stdlib/item/node/donut.js.map +1 -1
- package/esm/stdlib/item/node/ellipse.js +11 -6
- package/esm/stdlib/item/node/ellipse.js.map +1 -1
- package/esm/stdlib/item/node/hexagon.js +12 -7
- package/esm/stdlib/item/node/hexagon.js.map +1 -1
- package/esm/stdlib/item/node/image.js +13 -3
- package/esm/stdlib/item/node/image.js.map +1 -1
- package/esm/stdlib/item/node/index.d.ts +1 -0
- package/esm/stdlib/item/node/index.js +1 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/item/node/modelRect.d.ts +33 -1
- package/esm/stdlib/item/node/modelRect.js +135 -78
- package/esm/stdlib/item/node/modelRect.js.map +1 -1
- package/esm/stdlib/item/node/plane.d.ts +38 -0
- package/esm/stdlib/item/node/plane.js +62 -0
- package/esm/stdlib/item/node/plane.js.map +1 -0
- package/esm/stdlib/item/node/rect.js +12 -7
- package/esm/stdlib/item/node/rect.js.map +1 -1
- package/esm/stdlib/item/node/sphere.js +12 -7
- package/esm/stdlib/item/node/sphere.js.map +1 -1
- package/esm/stdlib/item/node/star.d.ts +1 -3
- package/esm/stdlib/item/node/star.js +16 -10
- package/esm/stdlib/item/node/star.js.map +1 -1
- package/esm/stdlib/item/node/triangle.js +17 -7
- package/esm/stdlib/item/node/triangle.js.map +1 -1
- package/esm/stdlib/plugin/edgeBundling/index.d.ts +75 -0
- package/esm/stdlib/plugin/edgeBundling/index.js +364 -0
- package/esm/stdlib/plugin/edgeBundling/index.js.map +1 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js +2 -2
- package/esm/stdlib/plugin/edgeFilterLens/index.js.map +1 -1
- package/esm/stdlib/plugin/fisheye/index.js +3 -2
- package/esm/stdlib/plugin/fisheye/index.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/bubbleset.d.ts +1 -1
- package/esm/stdlib/plugin/hull/bubbleset.js +13 -13
- package/esm/stdlib/plugin/hull/bubbleset.js.map +1 -1
- package/esm/stdlib/plugin/hull/index.d.ts +1 -1
- package/esm/stdlib/plugin/hull/index.js +4 -4
- package/esm/stdlib/plugin/hull/util.js +1 -1
- 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 +10 -10
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/lodController/index.d.ts +73 -0
- package/esm/stdlib/plugin/lodController/index.js +558 -0
- package/esm/stdlib/plugin/lodController/index.js.map +1 -0
- package/esm/stdlib/plugin/menu/index.js +1 -1
- package/esm/stdlib/plugin/menu/index.js.map +1 -1
- package/esm/stdlib/plugin/minimap/index.js +12 -14
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/snapline/index.d.ts +2 -2
- package/esm/stdlib/plugin/snapline/index.js +2 -2
- package/esm/stdlib/plugin/snapline/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +2 -2
- package/esm/stdlib/plugin/toolbar/index.js +27 -29
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/plugin/tooltip/index.d.ts +1 -1
- package/esm/stdlib/plugin/tooltip/index.js +3 -3
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
- package/{lib/stdlib/plugin/watermaker → esm/stdlib/plugin/watermarker}/index.d.ts +1 -1
- package/esm/stdlib/plugin/{watermaker → watermarker}/index.js +7 -7
- package/esm/stdlib/plugin/watermarker/index.js.map +1 -0
- package/esm/stdlib/selector/lasso.js +3 -3
- package/esm/stdlib/selector/lasso.js.map +1 -1
- package/esm/stdlib/theme/dark.js +31 -34
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/light.js +29 -29
- package/esm/stdlib/theme/light.js.map +1 -1
- package/esm/stdlib/themeSolver/spec.js +5 -5
- package/esm/stdlib/themeSolver/spec.js.map +1 -1
- package/esm/stdlib/themeSolver/subject.d.ts +1 -1
- package/esm/stdlib/themeSolver/subject.js +1 -1
- package/esm/types/animate.d.ts +2 -2
- package/esm/types/combo.d.ts +2 -2
- package/esm/types/data.d.ts +3 -1
- package/esm/types/edge.d.ts +2 -2
- package/esm/types/graph.d.ts +113 -51
- package/esm/types/hook.d.ts +18 -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 +17 -25
- package/esm/types/item.js.map +1 -1
- package/esm/types/layout.d.ts +8 -3
- package/esm/types/layout.js.map +1 -1
- package/esm/types/node.d.ts +4 -33
- package/esm/types/plugin.d.ts +2 -1
- package/esm/types/plugin.js +2 -1
- package/esm/types/plugin.js.map +1 -1
- package/esm/types/spec.d.ts +6 -5
- package/esm/types/theme.d.ts +8 -8
- package/esm/types/view.d.ts +1 -1
- package/esm/util/animate.d.ts +7 -2
- package/esm/util/animate.js +38 -24
- package/esm/util/animate.js.map +1 -1
- package/esm/util/bbox.d.ts +7 -1
- package/esm/util/bbox.js +16 -0
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/canvas.d.ts +1 -1
- package/esm/util/canvas.js +7 -1
- package/esm/util/canvas.js.map +1 -1
- package/esm/util/data.d.ts +16 -10
- package/esm/util/data.js +27 -14
- package/esm/util/data.js.map +1 -1
- package/esm/util/dom.js +5 -5
- package/esm/util/dom.js.map +1 -1
- package/esm/util/extend.js +1 -1
- package/esm/util/extend.js.map +1 -1
- package/esm/util/item.d.ts +1 -1
- package/esm/util/item.js +9 -9
- package/esm/util/item.js.map +1 -1
- package/esm/util/mapper.js +1 -1
- package/esm/util/mapper.js.map +1 -1
- package/esm/util/math.d.ts +1 -1
- package/esm/util/math.js +1 -1
- package/esm/util/path.d.ts +7 -2
- package/esm/util/path.js +73 -2
- package/esm/util/path.js.map +1 -1
- package/esm/util/polyline.d.ts +12 -2
- package/esm/util/polyline.js +25 -20
- package/esm/util/polyline.js.map +1 -1
- package/esm/util/router.d.ts +1 -1
- package/esm/util/router.js +26 -25
- package/esm/util/router.js.map +1 -1
- package/esm/util/shape.d.ts +26 -14
- package/esm/util/shape.js +56 -32
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.d.ts +2 -2
- package/esm/util/shape3d.js +9 -12
- package/esm/util/shape3d.js.map +1 -1
- package/esm/util/zoom.d.ts +5 -8
- package/esm/util/zoom.js +15 -20
- package/esm/util/zoom.js.map +1 -1
- package/lib/constant/shape.d.ts +2 -2
- package/lib/index.d.ts +6 -2
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +6 -4
- package/lib/item/combo.js +13 -4
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +12 -4
- package/lib/item/edge.js +105 -17
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +20 -10
- package/lib/item/item.js +112 -61
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +11 -4
- package/lib/item/node.js +102 -8
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +5 -1
- package/lib/runtime/controller/data.js +52 -10
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/index.d.ts +1 -1
- package/lib/runtime/controller/index.js +1 -1
- package/lib/runtime/controller/index.js.map +1 -1
- package/lib/runtime/controller/interaction.js +3 -2
- package/lib/runtime/controller/interaction.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +25 -13
- package/lib/runtime/controller/item.js +281 -113
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.d.ts +3 -0
- package/lib/runtime/controller/layout.js +176 -122
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/controller/plugin.d.ts +3 -0
- package/lib/runtime/controller/plugin.js +66 -24
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/controller/viewport.js +9 -2
- package/lib/runtime/controller/viewport.js.map +1 -1
- package/lib/runtime/graph.d.ts +75 -31
- package/lib/runtime/graph.js +320 -161
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/hooks.d.ts +2 -2
- package/lib/runtime/hooks.js +2 -2
- package/lib/stdlib/behavior/click-select.js +9 -3
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/create-edge.d.ts +1 -1
- package/lib/stdlib/behavior/drag-canvas.d.ts +1 -1
- package/lib/stdlib/behavior/drag-canvas.js +6 -3
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.js +8 -8
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.d.ts +5 -1
- package/lib/stdlib/behavior/drag-node.js +122 -28
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/hover-activate.d.ts +1 -1
- package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +1 -1
- package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +2 -2
- package/lib/stdlib/behavior/scroll-canvas.js +8 -8
- package/lib/stdlib/behavior/scroll-canvas.js.map +1 -1
- package/lib/stdlib/behavior/track-canvas-3d.d.ts +1 -1
- package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +1 -1
- package/lib/stdlib/behavior/zoom-canvas.d.ts +16 -0
- package/lib/stdlib/behavior/zoom-canvas.js +109 -7
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/mapNodeSize.js +2 -2
- package/lib/stdlib/data/mapNodeSize.js.map +1 -1
- package/lib/stdlib/data/transformV4Data.js +12 -6
- package/lib/stdlib/data/transformV4Data.js.map +1 -1
- package/lib/stdlib/data/validateData.js +2 -2
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +8 -4
- package/lib/stdlib/index.js +12 -8
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/combo/circle.js +12 -7
- package/lib/stdlib/item/combo/circle.js.map +1 -1
- package/lib/stdlib/item/combo/rect.js +12 -7
- package/lib/stdlib/item/combo/rect.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +24 -16
- package/lib/stdlib/item/edge/base.js +60 -121
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic.js +11 -6
- package/lib/stdlib/item/edge/cubic.js.map +1 -1
- package/lib/stdlib/item/edge/line.js +12 -7
- package/lib/stdlib/item/edge/line.js.map +1 -1
- package/lib/stdlib/item/edge/loop.js +6 -1
- package/lib/stdlib/item/edge/loop.js.map +1 -1
- package/lib/stdlib/item/edge/polyline.js +11 -6
- package/lib/stdlib/item/edge/polyline.js.map +1 -1
- package/lib/stdlib/item/edge/quadratic.js +11 -6
- package/lib/stdlib/item/edge/quadratic.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +26 -33
- package/lib/stdlib/item/node/base.js +98 -196
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.d.ts +11 -2
- package/lib/stdlib/item/node/base3d.js +14 -3
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/circle.js +13 -7
- package/lib/stdlib/item/node/circle.js.map +1 -1
- package/lib/stdlib/item/node/cube.d.ts +0 -2
- package/lib/stdlib/item/node/cube.js +12 -9
- package/lib/stdlib/item/node/cube.js.map +1 -1
- package/lib/stdlib/item/node/diamond.js +20 -11
- package/lib/stdlib/item/node/diamond.js.map +1 -1
- package/lib/stdlib/item/node/donut.js +18 -8
- package/lib/stdlib/item/node/donut.js.map +1 -1
- package/lib/stdlib/item/node/ellipse.js +11 -6
- package/lib/stdlib/item/node/ellipse.js.map +1 -1
- package/lib/stdlib/item/node/hexagon.js +12 -7
- package/lib/stdlib/item/node/hexagon.js.map +1 -1
- package/lib/stdlib/item/node/image.js +13 -3
- package/lib/stdlib/item/node/image.js.map +1 -1
- package/lib/stdlib/item/node/index.d.ts +1 -0
- package/lib/stdlib/item/node/index.js +1 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/item/node/modelRect.d.ts +33 -1
- package/lib/stdlib/item/node/modelRect.js +135 -78
- package/lib/stdlib/item/node/modelRect.js.map +1 -1
- package/lib/stdlib/item/node/plane.d.ts +38 -0
- package/lib/stdlib/item/node/plane.js +66 -0
- package/lib/stdlib/item/node/plane.js.map +1 -0
- package/lib/stdlib/item/node/rect.js +12 -7
- package/lib/stdlib/item/node/rect.js.map +1 -1
- package/lib/stdlib/item/node/sphere.js +12 -7
- package/lib/stdlib/item/node/sphere.js.map +1 -1
- package/lib/stdlib/item/node/star.d.ts +1 -3
- package/lib/stdlib/item/node/star.js +16 -10
- package/lib/stdlib/item/node/star.js.map +1 -1
- package/lib/stdlib/item/node/triangle.js +17 -7
- package/lib/stdlib/item/node/triangle.js.map +1 -1
- package/lib/stdlib/plugin/edgeBundling/index.d.ts +75 -0
- package/lib/stdlib/plugin/edgeBundling/index.js +368 -0
- package/lib/stdlib/plugin/edgeBundling/index.js.map +1 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js +2 -2
- package/lib/stdlib/plugin/edgeFilterLens/index.js.map +1 -1
- package/lib/stdlib/plugin/fisheye/index.js +2 -1
- package/lib/stdlib/plugin/fisheye/index.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/bubbleset.d.ts +1 -1
- package/lib/stdlib/plugin/hull/bubbleset.js +13 -13
- package/lib/stdlib/plugin/hull/bubbleset.js.map +1 -1
- package/lib/stdlib/plugin/hull/index.d.ts +1 -1
- package/lib/stdlib/plugin/hull/index.js +4 -4
- package/lib/stdlib/plugin/hull/util.js +1 -1
- 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 +10 -10
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/lodController/index.d.ts +73 -0
- package/lib/stdlib/plugin/lodController/index.js +562 -0
- package/lib/stdlib/plugin/lodController/index.js.map +1 -0
- package/lib/stdlib/plugin/menu/index.js +1 -1
- package/lib/stdlib/plugin/menu/index.js.map +1 -1
- package/lib/stdlib/plugin/minimap/index.js +12 -14
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/snapline/index.d.ts +2 -2
- package/lib/stdlib/plugin/snapline/index.js +2 -2
- package/lib/stdlib/plugin/snapline/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +2 -2
- package/lib/stdlib/plugin/toolbar/index.js +27 -29
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/plugin/tooltip/index.d.ts +1 -1
- package/lib/stdlib/plugin/tooltip/index.js +3 -3
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
- package/{esm/stdlib/plugin/watermaker → lib/stdlib/plugin/watermarker}/index.d.ts +1 -1
- package/lib/stdlib/plugin/{watermaker → watermarker}/index.js +7 -7
- package/lib/stdlib/plugin/watermarker/index.js.map +1 -0
- package/lib/stdlib/selector/lasso.js +3 -3
- package/lib/stdlib/selector/lasso.js.map +1 -1
- package/lib/stdlib/theme/dark.js +31 -34
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/light.js +29 -29
- package/lib/stdlib/theme/light.js.map +1 -1
- package/lib/stdlib/themeSolver/spec.js +5 -5
- package/lib/stdlib/themeSolver/spec.js.map +1 -1
- package/lib/stdlib/themeSolver/subject.d.ts +1 -1
- package/lib/stdlib/themeSolver/subject.js +1 -1
- package/lib/types/animate.d.ts +2 -2
- package/lib/types/combo.d.ts +2 -2
- package/lib/types/data.d.ts +3 -1
- package/lib/types/edge.d.ts +2 -2
- package/lib/types/graph.d.ts +113 -51
- package/lib/types/hook.d.ts +18 -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 +17 -25
- package/lib/types/item.js.map +1 -1
- package/lib/types/layout.d.ts +8 -3
- package/lib/types/layout.js.map +1 -1
- package/lib/types/node.d.ts +4 -33
- package/lib/types/plugin.d.ts +2 -1
- package/lib/types/plugin.js +2 -1
- package/lib/types/plugin.js.map +1 -1
- package/lib/types/spec.d.ts +6 -5
- package/lib/types/theme.d.ts +8 -8
- package/lib/types/view.d.ts +1 -1
- package/lib/util/animate.d.ts +7 -2
- package/lib/util/animate.js +38 -24
- package/lib/util/animate.js.map +1 -1
- package/lib/util/bbox.d.ts +7 -1
- package/lib/util/bbox.js +18 -1
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/canvas.d.ts +1 -1
- package/lib/util/canvas.js +7 -1
- package/lib/util/canvas.js.map +1 -1
- package/lib/util/data.d.ts +16 -10
- package/lib/util/data.js +30 -16
- package/lib/util/data.js.map +1 -1
- package/lib/util/dom.js +5 -5
- package/lib/util/dom.js.map +1 -1
- package/lib/util/extend.js +4 -7
- package/lib/util/extend.js.map +1 -1
- package/lib/util/item.d.ts +1 -1
- package/lib/util/item.js +9 -9
- package/lib/util/item.js.map +1 -1
- package/lib/util/mapper.js +1 -1
- package/lib/util/mapper.js.map +1 -1
- package/lib/util/math.d.ts +1 -1
- package/lib/util/math.js +1 -1
- package/lib/util/path.d.ts +7 -2
- package/lib/util/path.js +73 -2
- package/lib/util/path.js.map +1 -1
- package/lib/util/polyline.d.ts +12 -2
- package/lib/util/polyline.js +28 -21
- package/lib/util/polyline.js.map +1 -1
- package/lib/util/router.d.ts +1 -1
- package/lib/util/router.js +26 -25
- package/lib/util/router.js.map +1 -1
- package/lib/util/shape.d.ts +26 -14
- package/lib/util/shape.js +54 -30
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.d.ts +2 -2
- package/lib/util/shape3d.js +9 -12
- package/lib/util/shape3d.js.map +1 -1
- package/lib/util/zoom.d.ts +5 -8
- package/lib/util/zoom.js +17 -22
- package/lib/util/zoom.js.map +1 -1
- package/package.json +37 -53
- package/src/index.ts +1 -1
- package/src/item/combo.ts +15 -6
- package/src/item/edge.ts +135 -19
- package/src/item/item.ts +139 -66
- package/src/item/node.ts +125 -12
- package/src/runtime/controller/data.ts +80 -17
- package/src/runtime/controller/index.ts +1 -1
- package/src/runtime/controller/interaction.ts +5 -4
- package/src/runtime/controller/item.ts +398 -170
- package/src/runtime/controller/layout.ts +252 -113
- package/src/runtime/controller/plugin.ts +86 -33
- package/src/runtime/controller/viewport.ts +8 -2
- package/src/runtime/graph.ts +494 -212
- package/src/runtime/hooks.ts +2 -2
- package/src/stdlib/behavior/click-select.ts +8 -3
- package/src/stdlib/behavior/create-edge.ts +1 -1
- package/src/stdlib/behavior/drag-canvas.ts +7 -4
- package/src/stdlib/behavior/drag-combo.ts +8 -8
- package/src/stdlib/behavior/drag-node.ts +166 -51
- package/src/stdlib/behavior/hover-activate.ts +1 -1
- package/src/stdlib/behavior/orbit-canvas-3d.ts +1 -1
- package/src/stdlib/behavior/rotate-canvas-3d.ts +2 -2
- package/src/stdlib/behavior/scroll-canvas.ts +8 -8
- package/src/stdlib/behavior/track-canvas-3d.ts +1 -1
- package/src/stdlib/behavior/zoom-canvas-3d.ts +1 -1
- package/src/stdlib/behavior/zoom-canvas.ts +137 -16
- package/src/stdlib/data/mapNodeSize.ts +2 -2
- package/src/stdlib/data/transformV4Data.ts +27 -3
- package/src/stdlib/data/validateData.ts +2 -2
- package/src/stdlib/index.ts +11 -4
- package/src/stdlib/item/combo/circle.ts +26 -11
- package/src/stdlib/item/combo/rect.ts +26 -11
- package/src/stdlib/item/edge/base.ts +60 -163
- package/src/stdlib/item/edge/cubic.ts +26 -4
- package/src/stdlib/item/edge/line.ts +27 -5
- package/src/stdlib/item/edge/loop.ts +6 -1
- package/src/stdlib/item/edge/polyline.ts +26 -4
- package/src/stdlib/item/edge/quadratic.ts +26 -4
- package/src/stdlib/item/node/base.ts +91 -260
- package/src/stdlib/item/node/base3d.ts +19 -3
- package/src/stdlib/item/node/circle.ts +29 -8
- package/src/stdlib/item/node/cube.ts +26 -12
- package/src/stdlib/item/node/diamond.ts +35 -11
- package/src/stdlib/item/node/donut.ts +32 -18
- package/src/stdlib/item/node/ellipse.ts +25 -11
- package/src/stdlib/item/node/hexagon.ts +27 -7
- package/src/stdlib/item/node/image.ts +13 -5
- package/src/stdlib/item/node/index.ts +1 -0
- package/src/stdlib/item/node/modelRect.ts +230 -136
- package/src/stdlib/item/node/plane.ts +121 -0
- package/src/stdlib/item/node/rect.ts +27 -7
- package/src/stdlib/item/node/sphere.ts +26 -10
- package/src/stdlib/item/node/star.ts +32 -11
- package/src/stdlib/item/node/triangle.ts +32 -9
- package/src/stdlib/plugin/edgeBundling/index.ts +529 -0
- package/src/stdlib/plugin/edgeFilterLens/index.ts +2 -2
- package/src/stdlib/plugin/fisheye/index.ts +3 -2
- package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
- package/src/stdlib/plugin/hull/bubbleset.ts +14 -14
- package/src/stdlib/plugin/hull/index.ts +4 -4
- package/src/stdlib/plugin/hull/util.ts +1 -1
- package/src/stdlib/plugin/index.ts +2 -0
- package/src/stdlib/plugin/legend/index.ts +11 -12
- package/src/stdlib/plugin/lodController/index.ts +603 -0
- package/src/stdlib/plugin/menu/index.ts +1 -1
- package/src/stdlib/plugin/minimap/index.ts +12 -14
- package/src/stdlib/plugin/snapline/index.ts +3 -3
- package/src/stdlib/plugin/toolbar/index.ts +29 -31
- package/src/stdlib/plugin/tooltip/index.ts +4 -4
- package/src/stdlib/plugin/{watermaker → watermarker}/index.ts +8 -8
- package/src/stdlib/selector/lasso.ts +3 -3
- package/src/stdlib/theme/dark.ts +31 -34
- package/src/stdlib/theme/light.ts +29 -29
- package/src/stdlib/themeSolver/spec.ts +5 -5
- package/src/stdlib/themeSolver/subject.ts +1 -1
- package/src/types/animate.ts +3 -3
- package/src/types/combo.ts +2 -2
- package/src/types/data.ts +5 -1
- package/src/types/edge.ts +2 -2
- package/src/types/graph.ts +144 -61
- package/src/types/hook.ts +37 -3
- package/src/types/index.ts +2 -1
- package/src/types/item.ts +23 -30
- package/src/types/layout.ts +21 -16
- package/src/types/node.ts +4 -33
- package/src/types/plugin.ts +3 -1
- package/src/types/spec.ts +6 -5
- package/src/types/theme.ts +8 -8
- package/src/types/view.ts +1 -1
- package/src/util/animate.ts +105 -79
- package/src/util/bbox.ts +26 -1
- package/src/util/canvas.ts +8 -0
- package/src/util/data.ts +26 -15
- package/src/util/dom.ts +6 -6
- package/src/util/extend.ts +1 -1
- package/src/util/item.ts +16 -2
- package/src/util/mapper.ts +1 -1
- package/src/util/math.ts +1 -1
- package/src/util/path.ts +73 -3
- package/src/util/polyline.ts +33 -26
- package/src/util/router.ts +28 -26
- package/src/util/shape.ts +96 -44
- package/src/util/shape3d.ts +16 -10
- package/src/util/zoom.ts +19 -25
- package/esm/runtime/controller/extension.d.ts +0 -9
- package/esm/runtime/controller/extension.js +0 -11
- package/esm/runtime/controller/extension.js.map +0 -1
- package/esm/stdlib/plugin/watermaker/index.js.map +0 -1
- package/lib/runtime/controller/extension.d.ts +0 -9
- package/lib/runtime/controller/extension.js +0 -15
- package/lib/runtime/controller/extension.js.map +0 -1
- package/lib/stdlib/plugin/watermaker/index.js.map +0 -1
- package/src/runtime/controller/extension.ts +0 -14
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
OutNode,
|
|
8
8
|
Supervisor,
|
|
9
9
|
} from '@antv/layout';
|
|
10
|
-
import
|
|
10
|
+
import { Extensions, registry, stdLib } from '../../stdlib';
|
|
11
11
|
import {
|
|
12
12
|
IGraph,
|
|
13
13
|
isImmediatelyInvokedLayoutOptions,
|
|
@@ -108,16 +108,30 @@ export class LayoutController {
|
|
|
108
108
|
animationEffectTiming = {
|
|
109
109
|
duration: 1000,
|
|
110
110
|
} as Partial<IAnimationEffectTiming>,
|
|
111
|
+
presetLayout,
|
|
111
112
|
execute,
|
|
112
113
|
...rest
|
|
113
114
|
} = options;
|
|
114
115
|
|
|
116
|
+
// presetLayout layout
|
|
117
|
+
const nodesWithPosition = await this.presetLayout(
|
|
118
|
+
layoutData,
|
|
119
|
+
nodeSize,
|
|
120
|
+
width,
|
|
121
|
+
height,
|
|
122
|
+
center,
|
|
123
|
+
presetLayout,
|
|
124
|
+
params,
|
|
125
|
+
layoutGraphCore,
|
|
126
|
+
);
|
|
127
|
+
|
|
115
128
|
// It will ignore some layout options such as `type` and `workerEnabled`.
|
|
116
129
|
positions = await execute(layoutGraphCore, {
|
|
117
130
|
nodeSize,
|
|
118
131
|
width,
|
|
119
132
|
height,
|
|
120
133
|
center,
|
|
134
|
+
getMass: this.genericGetMass(options, nodesWithPosition),
|
|
121
135
|
preset: layoutNodes.map((node) => {
|
|
122
136
|
const { x, y, z } = node.data;
|
|
123
137
|
if (isNaN(x) || isNaN(y)) return;
|
|
@@ -146,129 +160,237 @@ export class LayoutController {
|
|
|
146
160
|
);
|
|
147
161
|
}
|
|
148
162
|
} else {
|
|
149
|
-
const {
|
|
150
|
-
type = 'grid',
|
|
151
|
-
animated = false,
|
|
152
|
-
animationEffectTiming = {
|
|
153
|
-
duration: 1000,
|
|
154
|
-
} as Partial<IAnimationEffectTiming>,
|
|
155
|
-
iterations = 300,
|
|
156
|
-
...rest
|
|
157
|
-
} = options;
|
|
158
|
-
let { workerEnabled = false } = options;
|
|
159
|
-
|
|
160
|
-
// Find built-in layout algorithms.
|
|
161
|
-
const layoutCtor = stdLib.layouts[type] || registery.useLib.layouts[type];
|
|
162
|
-
if (!layoutCtor) {
|
|
163
|
-
throw new Error(`Unknown layout algorithm: ${type}`);
|
|
164
|
-
}
|
|
163
|
+
const { presetLayout } = options;
|
|
165
164
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
animationEffectTiming,
|
|
178
|
-
graphCore,
|
|
179
|
-
layoutData,
|
|
180
|
-
animate,
|
|
181
|
-
);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
165
|
+
// presetLayout layout
|
|
166
|
+
const nodesWithPosition = await this.presetLayout(
|
|
167
|
+
layoutData,
|
|
168
|
+
nodeSize,
|
|
169
|
+
width,
|
|
170
|
+
height,
|
|
171
|
+
center,
|
|
172
|
+
presetLayout,
|
|
173
|
+
params,
|
|
174
|
+
layoutGraphCore,
|
|
175
|
+
);
|
|
184
176
|
|
|
185
|
-
//
|
|
186
|
-
|
|
187
|
-
|
|
177
|
+
// layout
|
|
178
|
+
// TODO: input positions affect the layout
|
|
179
|
+
positions = await this.layoutOnce(
|
|
180
|
+
layoutData,
|
|
188
181
|
nodeSize,
|
|
189
182
|
width,
|
|
190
183
|
height,
|
|
191
184
|
center,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
185
|
+
options,
|
|
186
|
+
params,
|
|
187
|
+
layoutGraphCore,
|
|
188
|
+
nodesWithPosition,
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Update nodes' positions.
|
|
193
|
+
this.updateNodesPosition(positions, animate);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
private layoutOnce = async (
|
|
197
|
+
layoutData,
|
|
198
|
+
nodeSize,
|
|
199
|
+
width,
|
|
200
|
+
height,
|
|
201
|
+
center,
|
|
202
|
+
options,
|
|
203
|
+
params,
|
|
204
|
+
layoutGraphCore,
|
|
205
|
+
nodesWithPosition?,
|
|
206
|
+
) => {
|
|
207
|
+
let positions: LayoutMapping;
|
|
208
|
+
const { graphCore, animate = true } = params;
|
|
209
|
+
const { nodes: layoutNodes } = layoutData;
|
|
210
|
+
const {
|
|
211
|
+
type = 'grid',
|
|
212
|
+
animated = false,
|
|
213
|
+
animationEffectTiming = {
|
|
214
|
+
duration: 1000,
|
|
215
|
+
} as Partial<IAnimationEffectTiming>,
|
|
216
|
+
iterations = 300,
|
|
217
|
+
...rest
|
|
218
|
+
} = options;
|
|
219
|
+
let { workerEnabled = false } = options;
|
|
220
|
+
|
|
221
|
+
// Find built-in layout algorithms.
|
|
222
|
+
const layoutCtor = stdLib.layouts[type] || registry.useLib.layouts[type];
|
|
223
|
+
if (!layoutCtor) {
|
|
224
|
+
throw new Error(`Unknown layout algorithm: ${type}`);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (isTreeLayout(options)) {
|
|
228
|
+
// tree layout type
|
|
229
|
+
await this.handleTreeLayout(
|
|
230
|
+
type,
|
|
231
|
+
{
|
|
232
|
+
nodeSize,
|
|
233
|
+
width,
|
|
234
|
+
height,
|
|
235
|
+
center,
|
|
236
|
+
...rest,
|
|
237
|
+
},
|
|
238
|
+
animationEffectTiming,
|
|
239
|
+
graphCore,
|
|
240
|
+
layoutData,
|
|
241
|
+
animate,
|
|
242
|
+
);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Initialize layout.
|
|
247
|
+
const useCache = layoutCtor === Extensions.DagreLayout;
|
|
248
|
+
const layout = new layoutCtor({
|
|
249
|
+
nodeSize,
|
|
250
|
+
width,
|
|
251
|
+
height,
|
|
252
|
+
center,
|
|
253
|
+
getMass: this.genericGetMass(options, nodesWithPosition),
|
|
254
|
+
preset: useCache
|
|
255
|
+
? layoutNodes
|
|
256
|
+
.map((node) => {
|
|
257
|
+
const { x, y, z } = node.data;
|
|
258
|
+
if (isNaN(x) || isNaN(y)) return;
|
|
259
|
+
const presetNode = { x, y, z };
|
|
260
|
+
const otherProps = this.previousNodes?.get(node.id) || {};
|
|
261
|
+
['_order', 'layer'].forEach((field) => {
|
|
262
|
+
presetNode[field] = node.data.hasOwnProperty(field)
|
|
263
|
+
? node.data[field]
|
|
264
|
+
: otherProps[field];
|
|
265
|
+
});
|
|
266
|
+
return {
|
|
267
|
+
id: node.id,
|
|
268
|
+
data: {
|
|
269
|
+
...otherProps,
|
|
270
|
+
...presetNode,
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
})
|
|
274
|
+
.filter(Boolean)
|
|
275
|
+
: undefined,
|
|
276
|
+
...rest,
|
|
277
|
+
});
|
|
278
|
+
this.currentLayout = layout;
|
|
279
|
+
|
|
280
|
+
// CustomLayout is not workerized.
|
|
281
|
+
if (!isLayoutWorkerized(options)) {
|
|
282
|
+
workerEnabled = false;
|
|
283
|
+
// TODO: console.warn();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (workerEnabled) {
|
|
287
|
+
/**
|
|
288
|
+
* Run algorithm in WebWorker, `animated` option will be ignored.
|
|
289
|
+
*/
|
|
290
|
+
const supervisor = new Supervisor(layoutGraphCore, layout, {
|
|
291
|
+
iterations,
|
|
215
292
|
});
|
|
216
|
-
this.
|
|
293
|
+
this.currentSupervisor = supervisor;
|
|
294
|
+
positions = await supervisor.execute();
|
|
295
|
+
} else {
|
|
296
|
+
// e.g. Force layout
|
|
297
|
+
if (isLayoutWithIterations(layout)) {
|
|
298
|
+
if (animated) {
|
|
299
|
+
/**
|
|
300
|
+
* `onTick` will get triggered in this case.
|
|
301
|
+
*/
|
|
302
|
+
positions = await layout.execute(layoutGraphCore, {
|
|
303
|
+
onTick: (positionsOnTick: LayoutMapping) => {
|
|
304
|
+
// Display the animated process of layout.
|
|
305
|
+
this.updateNodesPosition(positionsOnTick, false);
|
|
306
|
+
this.graph.emit('tick', positionsOnTick);
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
} else {
|
|
310
|
+
/**
|
|
311
|
+
* Manually step simulation in a sync way. `onTick` won't get triggered in this case,
|
|
312
|
+
* there will be no animation either.
|
|
313
|
+
*/
|
|
314
|
+
layout.execute(layoutGraphCore);
|
|
315
|
+
layout.stop();
|
|
316
|
+
positions = layout.tick(iterations);
|
|
317
|
+
}
|
|
318
|
+
} else {
|
|
319
|
+
positions = await layout.execute(layoutGraphCore);
|
|
217
320
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
321
|
+
if (animated) {
|
|
322
|
+
await this.animateLayoutWithoutIterations(
|
|
323
|
+
positions,
|
|
324
|
+
animationEffectTiming,
|
|
325
|
+
);
|
|
326
|
+
}
|
|
222
327
|
}
|
|
328
|
+
}
|
|
329
|
+
return positions;
|
|
330
|
+
};
|
|
223
331
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
332
|
+
private presetLayout = async (
|
|
333
|
+
layoutData,
|
|
334
|
+
nodeSize,
|
|
335
|
+
width,
|
|
336
|
+
height,
|
|
337
|
+
center,
|
|
338
|
+
presetLayout,
|
|
339
|
+
params,
|
|
340
|
+
layoutGraphCore,
|
|
341
|
+
) => {
|
|
342
|
+
// presetLayout has higher priority than the positions in data
|
|
343
|
+
if (presetLayout?.type) {
|
|
344
|
+
const presetPositions = await this.layoutOnce(
|
|
345
|
+
layoutData,
|
|
346
|
+
nodeSize,
|
|
347
|
+
width,
|
|
348
|
+
height,
|
|
349
|
+
center,
|
|
350
|
+
presetLayout,
|
|
351
|
+
params,
|
|
352
|
+
layoutGraphCore,
|
|
353
|
+
);
|
|
354
|
+
presetPositions.nodes.forEach((node) => {
|
|
355
|
+
layoutGraphCore.mergeNodeData(node.id, {
|
|
356
|
+
x: node.data.x,
|
|
357
|
+
y: node.data.y,
|
|
230
358
|
});
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
// e.g. Force layout
|
|
235
|
-
if (isLayoutWithIterations(layout)) {
|
|
236
|
-
if (animated) {
|
|
237
|
-
/**
|
|
238
|
-
* `onTick` will get triggered in this case.
|
|
239
|
-
*/
|
|
240
|
-
positions = await layout.execute(layoutGraphCore, {
|
|
241
|
-
onTick: (positionsOnTick: LayoutMapping) => {
|
|
242
|
-
// Display the animated process of layout.
|
|
243
|
-
this.updateNodesPosition(positionsOnTick);
|
|
244
|
-
this.graph.emit('tick', positionsOnTick);
|
|
245
|
-
},
|
|
246
|
-
});
|
|
247
|
-
} else {
|
|
248
|
-
/**
|
|
249
|
-
* Manually step simulation in a sync way. `onTick` won't get triggered in this case,
|
|
250
|
-
* there will be no animation either.
|
|
251
|
-
*/
|
|
252
|
-
layout.execute(layoutGraphCore);
|
|
253
|
-
layout.stop();
|
|
254
|
-
positions = layout.tick(iterations);
|
|
255
|
-
}
|
|
256
|
-
} else {
|
|
257
|
-
positions = await layout.execute(layoutGraphCore);
|
|
359
|
+
});
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
258
362
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
363
|
+
const nodeWithPostions = new Map();
|
|
364
|
+
// find the neighbors' mean center as the initial position for the nodes
|
|
365
|
+
const initNaNPositions: LayoutMapping = { nodes: [], edges: [] };
|
|
366
|
+
layoutData.nodes.forEach((node) => {
|
|
367
|
+
const { x, y } = node.data;
|
|
368
|
+
if (isNaN(x) || isNaN(y)) {
|
|
369
|
+
const meanCenter = { x: 0, y: 0, z: 0, count: 0 };
|
|
370
|
+
layoutGraphCore.getNeighbors(node.id).forEach((neighbor) => {
|
|
371
|
+
const { x: nx, y: ny, z: nz } = neighbor.data;
|
|
372
|
+
if (!isNaN(nx) && !isNaN(ny)) {
|
|
373
|
+
meanCenter.x += nx;
|
|
374
|
+
meanCenter.y += ny;
|
|
375
|
+
meanCenter.z += nz;
|
|
376
|
+
meanCenter.count++;
|
|
264
377
|
}
|
|
378
|
+
});
|
|
379
|
+
if (meanCenter.count) {
|
|
380
|
+
node.data.x = meanCenter.x / meanCenter.count + Math.random();
|
|
381
|
+
node.data.y = meanCenter.y / meanCenter.count + Math.random();
|
|
382
|
+
node.data.z = meanCenter.z / meanCenter.count + Math.random();
|
|
383
|
+
initNaNPositions.nodes.push(node);
|
|
265
384
|
}
|
|
385
|
+
} else {
|
|
386
|
+
nodeWithPostions.set(node.id, 1);
|
|
266
387
|
}
|
|
388
|
+
});
|
|
389
|
+
if (initNaNPositions.nodes.length) {
|
|
390
|
+
this.updateNodesPosition(initNaNPositions, false, false);
|
|
267
391
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
this.updateNodesPosition(positions, animate);
|
|
271
|
-
}
|
|
392
|
+
return nodeWithPostions;
|
|
393
|
+
};
|
|
272
394
|
|
|
273
395
|
async handleTreeLayout(
|
|
274
396
|
type,
|
|
@@ -316,7 +438,6 @@ export class LayoutController {
|
|
|
316
438
|
animationEffectTiming,
|
|
317
439
|
);
|
|
318
440
|
}
|
|
319
|
-
this.graph.emit('afterlayout');
|
|
320
441
|
this.updateNodesPosition(
|
|
321
442
|
{ nodes: nodePositions, edges: [] },
|
|
322
443
|
animated || animate,
|
|
@@ -353,12 +474,17 @@ export class LayoutController {
|
|
|
353
474
|
}
|
|
354
475
|
}
|
|
355
476
|
|
|
356
|
-
private updateNodesPosition(
|
|
477
|
+
private updateNodesPosition(
|
|
478
|
+
positions: LayoutMapping,
|
|
479
|
+
animate = true,
|
|
480
|
+
cache = true,
|
|
481
|
+
) {
|
|
482
|
+
if (!positions) return;
|
|
357
483
|
const { nodes, edges } = positions;
|
|
358
|
-
this.previousNodes = new Map();
|
|
484
|
+
if (cache) this.previousNodes = new Map();
|
|
359
485
|
const nodePositions = nodes.map((node) => {
|
|
360
486
|
const { x, y, z, ...others } = node.data;
|
|
361
|
-
this.previousNodes.set(node.id, others);
|
|
487
|
+
if (cache) this.previousNodes.set(node.id, others);
|
|
362
488
|
const data = isNaN(z) ? { x, y } : { x, y, z };
|
|
363
489
|
return {
|
|
364
490
|
id: node.id,
|
|
@@ -367,7 +493,7 @@ export class LayoutController {
|
|
|
367
493
|
});
|
|
368
494
|
this.graph.updateNodePosition(nodePositions, undefined, !animate);
|
|
369
495
|
const edgeToUpdate = edges
|
|
370
|
-
.filter((edge) => edge.data
|
|
496
|
+
.filter((edge) => edge.data?.controlPoints)
|
|
371
497
|
.map((edge) => ({
|
|
372
498
|
id: edge.id,
|
|
373
499
|
data: {
|
|
@@ -447,4 +573,17 @@ export class LayoutController {
|
|
|
447
573
|
|
|
448
574
|
await this.currentAnimation.finished;
|
|
449
575
|
}
|
|
576
|
+
|
|
577
|
+
private genericGetMass = (options, nodesWithPosition) => {
|
|
578
|
+
const { getMass: propGetMass } = options;
|
|
579
|
+
return (node) => {
|
|
580
|
+
const propGetMassVal = propGetMass?.(node);
|
|
581
|
+
if (!isNaN(propGetMassVal)) return propGetMassVal;
|
|
582
|
+
const { x, y, mass } = node.data;
|
|
583
|
+
if (!isNaN(mass)) return mass;
|
|
584
|
+
if (nodesWithPosition?.get(node.id)) return 10;
|
|
585
|
+
if (!nodesWithPosition && !isNaN(x) && !isNaN(y)) return 10;
|
|
586
|
+
return 1;
|
|
587
|
+
};
|
|
588
|
+
};
|
|
450
589
|
}
|
|
@@ -4,9 +4,18 @@ import { IGraph } from '../../types';
|
|
|
4
4
|
import { getExtension } from '../../util/extension';
|
|
5
5
|
import { Plugin as PluginBase } from '../../types/plugin';
|
|
6
6
|
import { IG6GraphEvent } from '../../types/event';
|
|
7
|
+
import { LodController } from '../../stdlib/plugin';
|
|
7
8
|
|
|
8
9
|
type Listener = (event: IG6GraphEvent) => void;
|
|
9
10
|
|
|
11
|
+
const REQUIRED_PLUGINS = [
|
|
12
|
+
{
|
|
13
|
+
key: 'lod-controller',
|
|
14
|
+
type: 'lod-controller',
|
|
15
|
+
pluginClass: LodController,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
|
|
10
19
|
/**
|
|
11
20
|
* Wraps the listener with error logging.
|
|
12
21
|
* @returns a new listener with error logging.
|
|
@@ -71,7 +80,26 @@ export class PluginController {
|
|
|
71
80
|
this.pluginMap.clear();
|
|
72
81
|
const { graph } = this;
|
|
73
82
|
const pluginConfigs = graph.getSpecification().plugins || [];
|
|
74
|
-
pluginConfigs
|
|
83
|
+
const plugins = [...pluginConfigs];
|
|
84
|
+
REQUIRED_PLUGINS.forEach((required) => {
|
|
85
|
+
if (
|
|
86
|
+
!pluginConfigs.find(
|
|
87
|
+
(plugin) =>
|
|
88
|
+
plugin === required.type ||
|
|
89
|
+
(plugin as any).type === required.type ||
|
|
90
|
+
plugin instanceof required.pluginClass,
|
|
91
|
+
)
|
|
92
|
+
) {
|
|
93
|
+
plugins.push(required.type);
|
|
94
|
+
|
|
95
|
+
if (!this.graph.specification.plugins) {
|
|
96
|
+
this.graph.specification.plugins = [];
|
|
97
|
+
}
|
|
98
|
+
this.graph.specification.plugins.push(required);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
plugins.forEach(this.initPlugin.bind(this));
|
|
75
103
|
|
|
76
104
|
// 2. Add listeners for each behavior.
|
|
77
105
|
this.listenersMap = {};
|
|
@@ -108,6 +136,14 @@ export class PluginController {
|
|
|
108
136
|
return { key, type, plugin };
|
|
109
137
|
}
|
|
110
138
|
|
|
139
|
+
private pluginIsRequired(config) {
|
|
140
|
+
if (typeof config.init === 'function' && config.options) {
|
|
141
|
+
return config.required;
|
|
142
|
+
}
|
|
143
|
+
const Plugin = getExtension(config, registry.useLib, 'plugin');
|
|
144
|
+
return Plugin?.required;
|
|
145
|
+
}
|
|
146
|
+
|
|
111
147
|
private onPluginChange(params: {
|
|
112
148
|
action: 'update' | 'add' | 'remove';
|
|
113
149
|
plugins: (string | { key: string; type: string; options: any })[];
|
|
@@ -115,6 +151,11 @@ export class PluginController {
|
|
|
115
151
|
const { action, plugins: pluginCfgs } = params;
|
|
116
152
|
if (action === 'add') {
|
|
117
153
|
pluginCfgs.forEach((config) => {
|
|
154
|
+
if (this.pluginIsRequired(config)) {
|
|
155
|
+
// update the existing required plugin
|
|
156
|
+
this.updatePlugin(config);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
118
159
|
const { key, plugin } = this.initPlugin(config);
|
|
119
160
|
this.addListeners(key, plugin, false);
|
|
120
161
|
});
|
|
@@ -123,47 +164,59 @@ export class PluginController {
|
|
|
123
164
|
|
|
124
165
|
if (action === 'remove') {
|
|
125
166
|
pluginCfgs.forEach((config) => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
).options?.key ||
|
|
135
|
-
(
|
|
136
|
-
config as {
|
|
137
|
-
key: string;
|
|
138
|
-
type: string;
|
|
139
|
-
options: any;
|
|
140
|
-
}
|
|
141
|
-
).type;
|
|
142
|
-
const item = this.pluginMap.get(key);
|
|
143
|
-
if (!item) return;
|
|
144
|
-
const { plugin } = item;
|
|
145
|
-
this.removeListeners(key);
|
|
146
|
-
plugin.destroy();
|
|
147
|
-
this.pluginMap.delete(key);
|
|
167
|
+
this.removePlugin(config);
|
|
168
|
+
if (this.pluginIsRequired(config)) {
|
|
169
|
+
// keep an internal required plugin with default configs
|
|
170
|
+
const pluginType = typeof config === 'string' ? config : config.type;
|
|
171
|
+
const { key, plugin } = this.initPlugin(pluginType);
|
|
172
|
+
this.addListeners(key, plugin, false);
|
|
173
|
+
}
|
|
148
174
|
});
|
|
149
175
|
return;
|
|
150
176
|
}
|
|
151
177
|
|
|
152
178
|
if (action === 'update') {
|
|
153
|
-
pluginCfgs.forEach((
|
|
154
|
-
if (typeof config === 'string') return;
|
|
155
|
-
const key = config.key || config.type;
|
|
156
|
-
const item = this.pluginMap.get(key);
|
|
157
|
-
if (!item) return;
|
|
158
|
-
const { plugin } = item;
|
|
159
|
-
plugin.updateCfgs(config);
|
|
160
|
-
this.removeListeners(key);
|
|
161
|
-
this.addListeners(key, plugin, false);
|
|
162
|
-
});
|
|
179
|
+
pluginCfgs.forEach(this.updatePlugin.bind(this));
|
|
163
180
|
return;
|
|
164
181
|
}
|
|
165
182
|
}
|
|
166
183
|
|
|
184
|
+
private removePlugin(config) {
|
|
185
|
+
const key =
|
|
186
|
+
(typeof config === 'string' ? config : config.key) ||
|
|
187
|
+
(
|
|
188
|
+
config as {
|
|
189
|
+
key: string;
|
|
190
|
+
type: string;
|
|
191
|
+
options: any;
|
|
192
|
+
}
|
|
193
|
+
).options?.key ||
|
|
194
|
+
(
|
|
195
|
+
config as {
|
|
196
|
+
key: string;
|
|
197
|
+
type: string;
|
|
198
|
+
options: any;
|
|
199
|
+
}
|
|
200
|
+
).type;
|
|
201
|
+
const item = this.pluginMap.get(key);
|
|
202
|
+
if (!item) return;
|
|
203
|
+
const { plugin } = item;
|
|
204
|
+
this.removeListeners(key);
|
|
205
|
+
plugin.destroy();
|
|
206
|
+
this.pluginMap.delete(key);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private updatePlugin(config) {
|
|
210
|
+
if (typeof config === 'string') return;
|
|
211
|
+
const key = config.key || config.type;
|
|
212
|
+
const item = this.pluginMap.get(key);
|
|
213
|
+
if (!item) return;
|
|
214
|
+
const { plugin } = item;
|
|
215
|
+
plugin.updateCfgs(config);
|
|
216
|
+
this.removeListeners(key);
|
|
217
|
+
this.addListeners(key, plugin, false);
|
|
218
|
+
}
|
|
219
|
+
|
|
167
220
|
/**
|
|
168
221
|
* Check if a plugin with the specified plugin key exists.
|
|
169
222
|
* @param {string} pluginKey The key of the plugin to check.
|
|
@@ -26,8 +26,12 @@ export class ViewportController {
|
|
|
26
26
|
}: ViewportChangeHookParams) {
|
|
27
27
|
const camera = this.graph.canvas.getCamera();
|
|
28
28
|
const transientCamera = this.graph.transientCanvas.getCamera();
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
if (camera.landmarks?.length) {
|
|
31
|
+
camera.cancelLandmarkAnimation();
|
|
32
|
+
transientCamera.cancelLandmarkAnimation();
|
|
33
|
+
this.graph.emit('cancelviewportanimation');
|
|
34
|
+
}
|
|
31
35
|
const {
|
|
32
36
|
translate,
|
|
33
37
|
rotate,
|
|
@@ -37,6 +41,7 @@ export class ViewportController {
|
|
|
37
41
|
const currentZoom = camera.getZoom();
|
|
38
42
|
|
|
39
43
|
if (effectTiming) {
|
|
44
|
+
this.graph.emit('beforeviewportanimation', transform);
|
|
40
45
|
const {
|
|
41
46
|
duration = 1000,
|
|
42
47
|
easing = 'linear',
|
|
@@ -109,6 +114,7 @@ export class ViewportController {
|
|
|
109
114
|
easing,
|
|
110
115
|
easingFunction,
|
|
111
116
|
onfinish: () => {
|
|
117
|
+
this.graph.emit('afterviewportanimation', transform);
|
|
112
118
|
resolve(undefined);
|
|
113
119
|
},
|
|
114
120
|
});
|