@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
|
@@ -2,13 +2,13 @@ import { AABB, DisplayObject } from '@antv/g';
|
|
|
2
2
|
import { OTHER_SHAPES_FIELD_NAME, RESERVED_SHAPE_IDS } from '../../../constant';
|
|
3
3
|
import { NodeDisplayModel } from '../../../types';
|
|
4
4
|
import {
|
|
5
|
-
BadgePosition,
|
|
6
5
|
GShapeStyle,
|
|
7
6
|
SHAPE_TYPE,
|
|
8
7
|
SHAPE_TYPE_3D,
|
|
9
8
|
ShapeStyle,
|
|
10
9
|
State,
|
|
11
|
-
|
|
10
|
+
LodLevelRanges,
|
|
11
|
+
ItemModelData,
|
|
12
12
|
} from '../../../types/item';
|
|
13
13
|
import {
|
|
14
14
|
NodeModelData,
|
|
@@ -28,68 +28,39 @@ import {
|
|
|
28
28
|
mergeStyles,
|
|
29
29
|
upsertShape,
|
|
30
30
|
} from '../../../util/shape';
|
|
31
|
+
import type { IGraph } from '../../../types/graph';
|
|
31
32
|
import { getWordWrapWidthByBox } from '../../../util/text';
|
|
32
33
|
import { convertToNumber } from '../../../util/type';
|
|
33
|
-
import { DEFAULT_ANIMATE_CFG, fadeIn, fadeOut } from '../../../util/animate';
|
|
34
|
-
import { getZoomLevel } from '../../../util/zoom';
|
|
35
|
-
import { AnimateCfg } from '../../../types/animate';
|
|
36
34
|
|
|
37
35
|
export abstract class BaseNode {
|
|
38
36
|
type: string;
|
|
37
|
+
graph: IGraph;
|
|
39
38
|
defaultStyles: NodeShapeStyles | ComboShapeStyles;
|
|
40
39
|
themeStyles: NodeShapeStyles | ComboShapeStyles;
|
|
41
40
|
mergedStyles: NodeShapeStyles | ComboShapeStyles;
|
|
42
|
-
|
|
41
|
+
lodLevels?: LodLevelRanges;
|
|
43
42
|
enableBalanceShape?: boolean;
|
|
44
43
|
//vertex coordinate
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
protected scaleTransformCache = '';
|
|
50
|
-
|
|
51
|
-
// cache the zoom level infomations
|
|
52
|
-
protected zoomCache: {
|
|
53
|
-
// the id of shapes which are hidden by zoom changing.
|
|
54
|
-
hiddenShape: { [shapeId: string]: boolean };
|
|
55
|
-
// the ratio to scale the shapes (e.g. labelShape, labelBackgroundShape) to keep to visual size while zooming.
|
|
56
|
-
balanceRatio: number;
|
|
57
|
-
// last responsed zoom ratio.
|
|
45
|
+
// cache the zoom level information
|
|
46
|
+
#zoomCache: {
|
|
47
|
+
// last response zoom ratio.
|
|
58
48
|
zoom: number;
|
|
59
|
-
// last responsed zoom level where the zoom ratio at. Zoom ratio 1 at level 0.
|
|
60
|
-
zoomLevel: number;
|
|
61
|
-
// shape ids in different zoom levels.
|
|
62
|
-
levelShapes: {
|
|
63
|
-
[level: string]: string[];
|
|
64
|
-
};
|
|
65
49
|
// wordWrapWidth of labelShape according to the maxWidth
|
|
66
50
|
wordWrapWidth: number;
|
|
67
|
-
// animate configurations for zoom level changing
|
|
68
|
-
animateConfig: AnimateCfg;
|
|
69
|
-
// the tag of first rendering
|
|
70
|
-
firstRender: boolean;
|
|
71
51
|
} = {
|
|
72
|
-
hiddenShape: {},
|
|
73
52
|
zoom: 1,
|
|
74
|
-
zoomLevel: 0,
|
|
75
|
-
balanceRatio: 1,
|
|
76
|
-
levelShapes: {},
|
|
77
53
|
wordWrapWidth: 32,
|
|
78
|
-
animateConfig: DEFAULT_ANIMATE_CFG.zoom,
|
|
79
|
-
firstRender: true,
|
|
80
54
|
};
|
|
81
55
|
|
|
82
56
|
constructor(props) {
|
|
83
|
-
const { themeStyles,
|
|
57
|
+
const { graph, themeStyles, lodLevels, enableBalanceShape, zoom } = props;
|
|
58
|
+
|
|
84
59
|
if (themeStyles) this.themeStyles = themeStyles;
|
|
85
|
-
this.
|
|
60
|
+
this.graph = graph;
|
|
61
|
+
this.lodLevels = lodLevels;
|
|
86
62
|
this.enableBalanceShape = enableBalanceShape;
|
|
87
|
-
this
|
|
88
|
-
this.zoomCache.balanceRatio = 1 / zoom;
|
|
89
|
-
this.zoomCache.animateConfig = {
|
|
90
|
-
...DEFAULT_ANIMATE_CFG.zoom,
|
|
91
|
-
...lodStrategy?.animateCfg,
|
|
92
|
-
};
|
|
63
|
+
this.#zoomCache.zoom = zoom;
|
|
93
64
|
}
|
|
94
65
|
|
|
95
66
|
/**
|
|
@@ -120,6 +91,7 @@ export abstract class BaseNode {
|
|
|
120
91
|
}
|
|
121
92
|
const { position } = data[fieldName][key];
|
|
122
93
|
dataStyles[`${position}BadgeShape`] = {
|
|
94
|
+
...this.themeStyles[fieldName],
|
|
123
95
|
...data[fieldName][key],
|
|
124
96
|
tag: 'badgeShape',
|
|
125
97
|
};
|
|
@@ -127,6 +99,7 @@ export abstract class BaseNode {
|
|
|
127
99
|
} else if (fieldName === 'anchorShapes') {
|
|
128
100
|
Object.keys(data[fieldName]).forEach((idx) => {
|
|
129
101
|
dataStyles[`anchorShape${idx}`] = {
|
|
102
|
+
...this.themeStyles[fieldName],
|
|
130
103
|
...data[fieldName][idx],
|
|
131
104
|
tag: 'anchorShape',
|
|
132
105
|
};
|
|
@@ -157,19 +130,9 @@ export abstract class BaseNode {
|
|
|
157
130
|
* @param shapeMap The shape map that contains all of the elements to show on the node.
|
|
158
131
|
*/
|
|
159
132
|
public updateCache(shapeMap) {
|
|
160
|
-
const levelShapes = {};
|
|
161
|
-
Object.keys(shapeMap).forEach((shapeId) => {
|
|
162
|
-
const { lod } = shapeMap[shapeId].attributes;
|
|
163
|
-
if (lod !== undefined) {
|
|
164
|
-
levelShapes[lod] = levelShapes[lod] || [];
|
|
165
|
-
levelShapes[lod].push(shapeId);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
this.zoomCache.levelShapes = levelShapes;
|
|
169
|
-
|
|
170
133
|
if (shapeMap.labelShape) {
|
|
171
134
|
const { maxWidth = '200%' } = this.mergedStyles.labelShape || {};
|
|
172
|
-
this
|
|
135
|
+
this.#zoomCache.wordWrapWidth = getWordWrapWidthByBox(
|
|
173
136
|
shapeMap.keyShape.getLocalBounds(),
|
|
174
137
|
maxWidth,
|
|
175
138
|
1,
|
|
@@ -210,7 +173,12 @@ export abstract class BaseNode {
|
|
|
210
173
|
public afterDraw(
|
|
211
174
|
model: NodeDisplayModel | ComboDisplayModel,
|
|
212
175
|
shapeMap: { [shapeId: string]: DisplayObject },
|
|
213
|
-
shapesChanged?: string[],
|
|
176
|
+
// shapesChanged?: string[],
|
|
177
|
+
diffData?: {
|
|
178
|
+
previous: NodeModelData | ComboModelData;
|
|
179
|
+
current: NodeModelData | ComboModelData;
|
|
180
|
+
},
|
|
181
|
+
diffState?: { previous: State[]; current: State[] },
|
|
214
182
|
): { [otherShapeId: string]: DisplayObject } {
|
|
215
183
|
return {};
|
|
216
184
|
}
|
|
@@ -286,7 +254,7 @@ export abstract class BaseNode {
|
|
|
286
254
|
const wordWrapWidth = getWordWrapWidthByBox(
|
|
287
255
|
keyShapeBox as AABB,
|
|
288
256
|
maxWidth,
|
|
289
|
-
this
|
|
257
|
+
this.#zoomCache.zoom,
|
|
290
258
|
this.enableBalanceShape,
|
|
291
259
|
);
|
|
292
260
|
|
|
@@ -325,7 +293,8 @@ export abstract class BaseNode {
|
|
|
325
293
|
positionPreset.textBaseline = 'middle';
|
|
326
294
|
positionPreset.offsetX = 4;
|
|
327
295
|
break;
|
|
328
|
-
default:
|
|
296
|
+
default:
|
|
297
|
+
// at bottom by default
|
|
329
298
|
positionPreset.offsetY = 2;
|
|
330
299
|
break;
|
|
331
300
|
}
|
|
@@ -351,7 +320,12 @@ export abstract class BaseNode {
|
|
|
351
320
|
if (angle) {
|
|
352
321
|
style.transform = `rotate(${angle}rad)`;
|
|
353
322
|
}
|
|
354
|
-
return this.upsertShape('text', 'labelShape', style,
|
|
323
|
+
return this.upsertShape('text', 'labelShape', style, {
|
|
324
|
+
model,
|
|
325
|
+
shapeMap,
|
|
326
|
+
diffData,
|
|
327
|
+
diffState,
|
|
328
|
+
});
|
|
355
329
|
}
|
|
356
330
|
|
|
357
331
|
/**
|
|
@@ -369,11 +343,11 @@ export abstract class BaseNode {
|
|
|
369
343
|
previous: NodeModelData | ComboModelData;
|
|
370
344
|
current: NodeModelData | ComboModelData;
|
|
371
345
|
},
|
|
372
|
-
diffState?: {
|
|
346
|
+
diffState?: { previous: State[]; current: State[] },
|
|
373
347
|
): DisplayObject {
|
|
374
348
|
const { labelShape } = shapeMap;
|
|
375
349
|
if (!labelShape || !labelShape.style.text || !model.data.labelShape) return;
|
|
376
|
-
// label's local bounds, will take scale into
|
|
350
|
+
// label's local bounds, will take scale into account
|
|
377
351
|
const textBBoxGeo = labelShape.getGeometryBounds();
|
|
378
352
|
const height = textBBoxGeo.max[1] - textBBoxGeo.min[1];
|
|
379
353
|
const width = Math.min(
|
|
@@ -392,14 +366,12 @@ export abstract class BaseNode {
|
|
|
392
366
|
width: width + padding[1] + padding[3],
|
|
393
367
|
height: height + padding[0] + padding[2],
|
|
394
368
|
};
|
|
395
|
-
const bgShape = this.upsertShape(
|
|
396
|
-
'rect',
|
|
397
|
-
'labelBackgroundShape',
|
|
398
|
-
bgStyle,
|
|
399
|
-
shapeMap,
|
|
369
|
+
const bgShape = this.upsertShape('rect', 'labelBackgroundShape', bgStyle, {
|
|
400
370
|
model,
|
|
401
|
-
|
|
402
|
-
|
|
371
|
+
shapeMap,
|
|
372
|
+
diffData,
|
|
373
|
+
diffState,
|
|
374
|
+
});
|
|
403
375
|
|
|
404
376
|
return bgShape;
|
|
405
377
|
}
|
|
@@ -450,8 +422,12 @@ export abstract class BaseNode {
|
|
|
450
422
|
iconShapeType,
|
|
451
423
|
'iconShape',
|
|
452
424
|
shapeStyle as GShapeStyle,
|
|
453
|
-
|
|
454
|
-
|
|
425
|
+
{
|
|
426
|
+
shapeMap,
|
|
427
|
+
model,
|
|
428
|
+
diffData,
|
|
429
|
+
diffState,
|
|
430
|
+
},
|
|
455
431
|
);
|
|
456
432
|
}
|
|
457
433
|
|
|
@@ -478,21 +454,23 @@ export abstract class BaseNode {
|
|
|
478
454
|
if (haloShapeStyle.visible === false) return;
|
|
479
455
|
const { nodeName, attributes } = keyShape;
|
|
480
456
|
const { x, y, fill } = attributes;
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
},
|
|
493
|
-
shapeMap,
|
|
457
|
+
const s = {
|
|
458
|
+
...attributes,
|
|
459
|
+
...keyShapeStyle,
|
|
460
|
+
x,
|
|
461
|
+
y,
|
|
462
|
+
stroke: fill,
|
|
463
|
+
...haloShapeStyle,
|
|
464
|
+
batchKey: 'halo',
|
|
465
|
+
};
|
|
466
|
+
delete s.fillOpacity;
|
|
467
|
+
const shape = this.upsertShape(nodeName as SHAPE_TYPE, 'haloShape', s, {
|
|
494
468
|
model,
|
|
495
|
-
|
|
469
|
+
shapeMap,
|
|
470
|
+
diffData,
|
|
471
|
+
diffState,
|
|
472
|
+
});
|
|
473
|
+
return shape;
|
|
496
474
|
}
|
|
497
475
|
|
|
498
476
|
/**
|
|
@@ -525,7 +503,7 @@ export abstract class BaseNode {
|
|
|
525
503
|
const anchorPositionMap = this.calculateAnchorPosition(keyShapeStyle);
|
|
526
504
|
individualConfigs.forEach((config, i) => {
|
|
527
505
|
const { position, fill = keyShapeStyle.fill, ...style } = config;
|
|
528
|
-
const [cx, cy] = this
|
|
506
|
+
const [cx, cy] = this.#getAnchorPosition(
|
|
529
507
|
position,
|
|
530
508
|
anchorPositionMap,
|
|
531
509
|
shapeMap,
|
|
@@ -541,14 +519,18 @@ export abstract class BaseNode {
|
|
|
541
519
|
...commonStyle,
|
|
542
520
|
...style,
|
|
543
521
|
} as GShapeStyle,
|
|
544
|
-
|
|
545
|
-
|
|
522
|
+
{
|
|
523
|
+
shapeMap,
|
|
524
|
+
model,
|
|
525
|
+
diffData,
|
|
526
|
+
diffState,
|
|
527
|
+
},
|
|
546
528
|
);
|
|
547
529
|
});
|
|
548
530
|
return shapes;
|
|
549
531
|
}
|
|
550
532
|
|
|
551
|
-
|
|
533
|
+
#getAnchorPosition(
|
|
552
534
|
position: string | [number, number],
|
|
553
535
|
anchorPositionMap: IAnchorPositionMap,
|
|
554
536
|
shapeMap: NodeShapeMap | ComboShapeMap,
|
|
@@ -722,8 +704,12 @@ export abstract class BaseNode {
|
|
|
722
704
|
textBaseline: 'middle',
|
|
723
705
|
zIndex: (zIndex as number) + 1,
|
|
724
706
|
} as GShapeStyle,
|
|
725
|
-
|
|
726
|
-
|
|
707
|
+
{
|
|
708
|
+
shapeMap,
|
|
709
|
+
model,
|
|
710
|
+
diffData,
|
|
711
|
+
diffState,
|
|
712
|
+
},
|
|
727
713
|
);
|
|
728
714
|
const bbox = shapes[id].getLocalBounds();
|
|
729
715
|
|
|
@@ -746,8 +732,12 @@ export abstract class BaseNode {
|
|
|
746
732
|
y: bbox.center[1] - bgHeight / 2,
|
|
747
733
|
...otherStyles,
|
|
748
734
|
} as GShapeStyle,
|
|
749
|
-
|
|
750
|
-
|
|
735
|
+
{
|
|
736
|
+
shapeMap,
|
|
737
|
+
model,
|
|
738
|
+
diffData,
|
|
739
|
+
diffState,
|
|
740
|
+
},
|
|
751
741
|
);
|
|
752
742
|
});
|
|
753
743
|
|
|
@@ -785,167 +775,7 @@ export abstract class BaseNode {
|
|
|
785
775
|
shapeMap: NodeShapeMap | ComboShapeMap,
|
|
786
776
|
zoom: number,
|
|
787
777
|
cacheHiddenShape = {},
|
|
788
|
-
) => {
|
|
789
|
-
// zoomLevel changed
|
|
790
|
-
if (this.lodStrategy) {
|
|
791
|
-
const { levels } = this.lodStrategy;
|
|
792
|
-
// last zoom ratio responsed by zoom changing, which might not equal to zoom.previous in props since the function is debounced.
|
|
793
|
-
const {
|
|
794
|
-
levelShapes,
|
|
795
|
-
hiddenShape,
|
|
796
|
-
animateConfig,
|
|
797
|
-
firstRender = true,
|
|
798
|
-
zoomLevel: previousLevel,
|
|
799
|
-
} = this.zoomCache;
|
|
800
|
-
const currentLevel = getZoomLevel(levels, zoom);
|
|
801
|
-
const levelNums = Object.keys(levelShapes).map(Number);
|
|
802
|
-
const maxLevel = Math.max(...levelNums);
|
|
803
|
-
const minLevel = Math.min(...levelNums);
|
|
804
|
-
if (currentLevel < previousLevel) {
|
|
805
|
-
if (firstRender) {
|
|
806
|
-
// zoomLevel changed, from higher to lower, hide something
|
|
807
|
-
for (let i = currentLevel + 1; i <= maxLevel; i++) {
|
|
808
|
-
levelShapes[String(i)]?.forEach((id) => {
|
|
809
|
-
if (!shapeMap[id] || cacheHiddenShape[id]) return;
|
|
810
|
-
shapeMap[id].hide();
|
|
811
|
-
hiddenShape[id] = true;
|
|
812
|
-
});
|
|
813
|
-
}
|
|
814
|
-
} else {
|
|
815
|
-
// zoomLevel changed, from higher to lower, hide something
|
|
816
|
-
for (let i = currentLevel + 1; i <= maxLevel; i++) {
|
|
817
|
-
levelShapes[String(i)]?.forEach((id) =>
|
|
818
|
-
fadeOut(id, shapeMap[id], hiddenShape, animateConfig),
|
|
819
|
-
);
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
} else if (currentLevel > previousLevel) {
|
|
823
|
-
// zoomLevel changed, from lower to higher, show something
|
|
824
|
-
for (let i = currentLevel; i >= minLevel; i--) {
|
|
825
|
-
levelShapes[String(i)]?.forEach((id) => {
|
|
826
|
-
fadeIn(
|
|
827
|
-
id,
|
|
828
|
-
shapeMap[id],
|
|
829
|
-
this.mergedStyles[id] ||
|
|
830
|
-
this.mergedStyles[id.replace('Background', '')],
|
|
831
|
-
hiddenShape,
|
|
832
|
-
animateConfig,
|
|
833
|
-
);
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
this.zoomCache.zoomLevel = currentLevel;
|
|
838
|
-
}
|
|
839
|
-
this.balanceShapeSize(shapeMap, zoom);
|
|
840
|
-
this.zoomCache.zoom = zoom;
|
|
841
|
-
};
|
|
842
|
-
|
|
843
|
-
/**
|
|
844
|
-
* Update the shapes' sizes e.g. labelShape, labelBackgroundShape, to keep the visual size while zooming.
|
|
845
|
-
* @param shapeMap
|
|
846
|
-
* @param zoom
|
|
847
|
-
* @returns
|
|
848
|
-
*/
|
|
849
|
-
private balanceShapeSize(
|
|
850
|
-
shapeMap: NodeShapeMap | ComboShapeMap,
|
|
851
|
-
zoom: number,
|
|
852
|
-
) {
|
|
853
|
-
if (!this.enableBalanceShape) return;
|
|
854
|
-
// balance the size for label, badges
|
|
855
|
-
const { keyShape, labelShape, labelBackgroundShape } = shapeMap;
|
|
856
|
-
const balanceRatio = 1 / zoom || 1;
|
|
857
|
-
this.zoomCache.balanceRatio = balanceRatio;
|
|
858
|
-
if (!labelShape || !labelShape.isVisible()) return;
|
|
859
|
-
const { position = 'bottom' } = this.mergedStyles.labelShape;
|
|
860
|
-
|
|
861
|
-
const keyShapeLocal = keyShape.getLocalBounds();
|
|
862
|
-
if (zoom < 1) {
|
|
863
|
-
// if it is zoom-out, do not scale the gap between keyShape and labelShape, differentiate from zoom-in by adjusting transformOrigin
|
|
864
|
-
if (position === 'bottom') labelShape.style.transformOrigin = '0';
|
|
865
|
-
else labelShape.style.transformOrigin = '';
|
|
866
|
-
} else {
|
|
867
|
-
switch (position) {
|
|
868
|
-
case 'bottom':
|
|
869
|
-
labelShape.style.transformOrigin = `0 ${
|
|
870
|
-
keyShapeLocal.max[1] - labelShape.attributes.y
|
|
871
|
-
}`;
|
|
872
|
-
break;
|
|
873
|
-
case 'right':
|
|
874
|
-
labelShape.style.transformOrigin = `${
|
|
875
|
-
keyShapeLocal.max[0] - labelShape.attributes.x
|
|
876
|
-
} 0`;
|
|
877
|
-
break;
|
|
878
|
-
case 'top':
|
|
879
|
-
labelShape.style.transformOrigin = `0 ${
|
|
880
|
-
keyShapeLocal.min[1] - labelShape.attributes.y
|
|
881
|
-
}`;
|
|
882
|
-
break;
|
|
883
|
-
case 'left':
|
|
884
|
-
labelShape.style.transformOrigin = `${
|
|
885
|
-
keyShapeLocal.min[0] - labelShape.attributes.x
|
|
886
|
-
} 0`;
|
|
887
|
-
break;
|
|
888
|
-
default:
|
|
889
|
-
// center
|
|
890
|
-
labelShape.style.transformOrigin = ``;
|
|
891
|
-
break;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
const oriTransform = (labelShape.style.transform || '').replace(
|
|
895
|
-
this.scaleTransformCache,
|
|
896
|
-
'',
|
|
897
|
-
);
|
|
898
|
-
const scaleTransform = `scale(${balanceRatio}, ${balanceRatio})`;
|
|
899
|
-
labelShape.style.transform = `${oriTransform} ${scaleTransform}`;
|
|
900
|
-
this.scaleTransformCache = scaleTransform;
|
|
901
|
-
labelShape.style.wordWrapWidth = this.zoomCache.wordWrapWidth * zoom;
|
|
902
|
-
|
|
903
|
-
if (!labelBackgroundShape || !labelBackgroundShape.isVisible()) return;
|
|
904
|
-
|
|
905
|
-
const [paddingTop, paddingRight, paddingBottom, paddingLeft] = this
|
|
906
|
-
.mergedStyles.labelBackgroundShape.padding as number[];
|
|
907
|
-
const sidePadding = paddingRight + paddingLeft;
|
|
908
|
-
const { width, height, x, y } = labelBackgroundShape.attributes;
|
|
909
|
-
|
|
910
|
-
switch (position) {
|
|
911
|
-
case 'top':
|
|
912
|
-
// if it is zoom-out, do not scale the gap between keyShape and labelShape, differentiate from zoom-in by adjusting transformOrigin
|
|
913
|
-
labelBackgroundShape.style.transformOrigin = `${
|
|
914
|
-
paddingLeft + (width - sidePadding) / 2
|
|
915
|
-
} ${zoom < 1 ? height - paddingBottom : keyShapeLocal.min[1] - y}`;
|
|
916
|
-
break;
|
|
917
|
-
case 'left':
|
|
918
|
-
labelBackgroundShape.style.transformOrigin = `${
|
|
919
|
-
zoom < 1 ? width - paddingRight : keyShapeLocal.min[0] - x
|
|
920
|
-
} ${paddingTop + (height - paddingTop - paddingBottom) / 2}`;
|
|
921
|
-
break;
|
|
922
|
-
case 'right':
|
|
923
|
-
labelBackgroundShape.style.transformOrigin = `${
|
|
924
|
-
zoom < 1 ? paddingLeft : keyShapeLocal.max[0] - x
|
|
925
|
-
} ${paddingTop + (height - paddingTop - paddingBottom) / 2}`;
|
|
926
|
-
break;
|
|
927
|
-
case 'bottom':
|
|
928
|
-
labelBackgroundShape.style.transformOrigin = `${
|
|
929
|
-
paddingLeft + (width - sidePadding) / 2
|
|
930
|
-
} ${
|
|
931
|
-
zoom < 1
|
|
932
|
-
? paddingTop + (height - paddingTop - paddingBottom) / 2
|
|
933
|
-
: keyShapeLocal.max[1] - y
|
|
934
|
-
}`;
|
|
935
|
-
break;
|
|
936
|
-
default:
|
|
937
|
-
// center
|
|
938
|
-
labelBackgroundShape.style.transformOrigin = `${
|
|
939
|
-
paddingLeft + (width - sidePadding) / 2
|
|
940
|
-
} ${paddingTop + (height - paddingTop - paddingBottom) / 2}`;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
const labelBBox = labelShape.getGeometryBounds();
|
|
944
|
-
const labelWidth = labelBBox.max[0] - labelBBox.min[0];
|
|
945
|
-
const xAxistRatio = (labelWidth * balanceRatio + sidePadding) / width;
|
|
946
|
-
|
|
947
|
-
labelBackgroundShape.style.transform = `scale(${xAxistRatio}, ${balanceRatio})`;
|
|
948
|
-
}
|
|
778
|
+
) => {};
|
|
949
779
|
|
|
950
780
|
/**
|
|
951
781
|
* Create (if does not exit in shapeMap) or update the shape according to the configurations.
|
|
@@ -960,15 +790,16 @@ export abstract class BaseNode {
|
|
|
960
790
|
type: SHAPE_TYPE | SHAPE_TYPE_3D,
|
|
961
791
|
id: string,
|
|
962
792
|
style: ShapeStyle,
|
|
963
|
-
|
|
964
|
-
|
|
793
|
+
config: {
|
|
794
|
+
model: NodeDisplayModel | ComboDisplayModel;
|
|
795
|
+
shapeMap: NodeShapeMap | ComboShapeMap;
|
|
796
|
+
diffData?: {
|
|
797
|
+
previous: NodeModelData | ComboModelData;
|
|
798
|
+
current: NodeModelData | ComboModelData;
|
|
799
|
+
};
|
|
800
|
+
diffState?: { previous: State[]; current: State[] };
|
|
801
|
+
},
|
|
965
802
|
): DisplayObject {
|
|
966
|
-
return upsertShape(
|
|
967
|
-
type as SHAPE_TYPE,
|
|
968
|
-
id,
|
|
969
|
-
style as GShapeStyle,
|
|
970
|
-
shapeMap,
|
|
971
|
-
model,
|
|
972
|
-
);
|
|
803
|
+
return upsertShape(type as SHAPE_TYPE, id, style as GShapeStyle, config);
|
|
973
804
|
}
|
|
974
805
|
}
|
|
@@ -107,7 +107,12 @@ export abstract class BaseNode3D extends BaseNode {
|
|
|
107
107
|
...otherStyle,
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
return this.upsertShape('text', 'labelShape', style,
|
|
110
|
+
return this.upsertShape('text', 'labelShape', style, {
|
|
111
|
+
model,
|
|
112
|
+
shapeMap,
|
|
113
|
+
diffData,
|
|
114
|
+
diffState,
|
|
115
|
+
});
|
|
111
116
|
}
|
|
112
117
|
|
|
113
118
|
/**
|
|
@@ -146,7 +151,12 @@ export abstract class BaseNode3D extends BaseNode {
|
|
|
146
151
|
stroke: attributes.fill,
|
|
147
152
|
...haloShapeStyle,
|
|
148
153
|
},
|
|
149
|
-
|
|
154
|
+
{
|
|
155
|
+
model,
|
|
156
|
+
shapeMap,
|
|
157
|
+
diffData,
|
|
158
|
+
diffState,
|
|
159
|
+
},
|
|
150
160
|
);
|
|
151
161
|
}
|
|
152
162
|
|
|
@@ -195,8 +205,14 @@ export abstract class BaseNode3D extends BaseNode {
|
|
|
195
205
|
type: SHAPE_TYPE_3D | SHAPE_TYPE,
|
|
196
206
|
id: string,
|
|
197
207
|
style: ShapeStyle,
|
|
198
|
-
|
|
208
|
+
config: {
|
|
209
|
+
model: NodeDisplayModel;
|
|
210
|
+
shapeMap: NodeShapeMap;
|
|
211
|
+
diffData?: { previous: NodeModelData; current: NodeModelData };
|
|
212
|
+
diffState?: { previous: State[]; current: State[] };
|
|
213
|
+
},
|
|
199
214
|
): DisplayObject {
|
|
215
|
+
const { shapeMap } = config;
|
|
200
216
|
return upsertShape3D(type, id, style as GShapeStyle, shapeMap, this.device);
|
|
201
217
|
}
|
|
202
218
|
|
|
@@ -32,16 +32,26 @@ export class CircleNode extends BaseNode {
|
|
|
32
32
|
let shapes: NodeShapeMap = { keyShape: undefined };
|
|
33
33
|
|
|
34
34
|
// keyShape
|
|
35
|
-
shapes.keyShape = this.drawKeyShape(model, shapeMap, diffData);
|
|
35
|
+
shapes.keyShape = this.drawKeyShape(model, shapeMap, diffData, diffState);
|
|
36
36
|
|
|
37
37
|
// haloShape
|
|
38
38
|
if (data.haloShape && this.drawHaloShape) {
|
|
39
|
-
shapes.haloShape = this.drawHaloShape(
|
|
39
|
+
shapes.haloShape = this.drawHaloShape(
|
|
40
|
+
model,
|
|
41
|
+
shapeMap,
|
|
42
|
+
diffData,
|
|
43
|
+
diffState,
|
|
44
|
+
);
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
// labelShape
|
|
43
48
|
if (data.labelShape && this.drawLabelShape) {
|
|
44
|
-
shapes.labelShape = this.drawLabelShape(
|
|
49
|
+
shapes.labelShape = this.drawLabelShape(
|
|
50
|
+
model,
|
|
51
|
+
shapeMap,
|
|
52
|
+
diffData,
|
|
53
|
+
diffState,
|
|
54
|
+
);
|
|
45
55
|
}
|
|
46
56
|
|
|
47
57
|
// labelBackgroundShape
|
|
@@ -50,6 +60,7 @@ export class CircleNode extends BaseNode {
|
|
|
50
60
|
model,
|
|
51
61
|
shapeMap,
|
|
52
62
|
diffData,
|
|
63
|
+
diffState,
|
|
53
64
|
);
|
|
54
65
|
}
|
|
55
66
|
|
|
@@ -69,7 +80,12 @@ export class CircleNode extends BaseNode {
|
|
|
69
80
|
|
|
70
81
|
// iconShape
|
|
71
82
|
if (data.iconShape && this.drawIconShape) {
|
|
72
|
-
shapes.iconShape = this.drawIconShape(
|
|
83
|
+
shapes.iconShape = this.drawIconShape(
|
|
84
|
+
model,
|
|
85
|
+
shapeMap,
|
|
86
|
+
diffData,
|
|
87
|
+
diffState,
|
|
88
|
+
);
|
|
73
89
|
}
|
|
74
90
|
|
|
75
91
|
// badgeShape
|
|
@@ -90,7 +106,7 @@ export class CircleNode extends BaseNode {
|
|
|
90
106
|
if (data.otherShapes && this.drawOtherShapes) {
|
|
91
107
|
shapes = {
|
|
92
108
|
...shapes,
|
|
93
|
-
...this.drawOtherShapes(model, shapeMap, diffData),
|
|
109
|
+
...this.drawOtherShapes(model, shapeMap, diffData, diffState),
|
|
94
110
|
};
|
|
95
111
|
}
|
|
96
112
|
return shapes;
|
|
@@ -102,12 +118,17 @@ export class CircleNode extends BaseNode {
|
|
|
102
118
|
diffData?: { previous: NodeModelData; current: NodeModelData },
|
|
103
119
|
diffState?: { previous: State[]; current: State[] },
|
|
104
120
|
): DisplayObject {
|
|
105
|
-
|
|
121
|
+
const shape = this.upsertShape(
|
|
106
122
|
'circle',
|
|
107
123
|
'keyShape',
|
|
108
124
|
this.mergedStyles.keyShape,
|
|
109
|
-
|
|
110
|
-
|
|
125
|
+
{
|
|
126
|
+
model,
|
|
127
|
+
shapeMap,
|
|
128
|
+
diffData,
|
|
129
|
+
diffState,
|
|
130
|
+
},
|
|
111
131
|
);
|
|
132
|
+
return shape;
|
|
112
133
|
}
|
|
113
134
|
}
|