@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
|
@@ -8,21 +8,50 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { Group } from '@antv/g';
|
|
11
|
-
import { debounce,
|
|
11
|
+
import { debounce, isArray, isNumber, isObject, uniq, uniqueId, } from '@antv/util';
|
|
12
12
|
import { DirectionalLight, AmbientLight } from '@antv/g-plugin-3d';
|
|
13
13
|
import registry from '../../stdlib';
|
|
14
14
|
import Node from '../../item/node';
|
|
15
15
|
import Edge from '../../item/edge';
|
|
16
16
|
import Combo from '../../item/combo';
|
|
17
|
-
import { getCombinedBoundsByData, upsertShape } from '../../util/shape';
|
|
17
|
+
import { getCombinedBoundsByData, intersectBBox, upsertShape, } from '../../util/shape';
|
|
18
18
|
import { getExtension } from '../../util/extension';
|
|
19
19
|
import { upsertTransientItem } from '../../util/item';
|
|
20
|
-
import {
|
|
20
|
+
import { formatLodLevels } from '../../util/zoom';
|
|
21
21
|
import { deconstructData, graphComboTreeDfs, graphCoreTreeDfs, traverseAncestors, traverseAncestorsAndSucceeds, traverseGraphAncestors, } from '../../util/data';
|
|
22
22
|
import { getGroupedChanges } from '../../util/event';
|
|
23
|
-
import { EdgeCollisionChecker, QuadTree } from '../../util/polyline';
|
|
24
23
|
import { isBBoxInBBox, isPointInBBox } from '../../util/bbox';
|
|
25
24
|
import { convertToNumber } from '../../util/type';
|
|
25
|
+
import { isPointPreventPolylineOverlap, isPolylineWithObstacleAvoidance, } from '../../util/polyline';
|
|
26
|
+
var WARN_TYPE;
|
|
27
|
+
(function (WARN_TYPE) {
|
|
28
|
+
WARN_TYPE[WARN_TYPE["FAIL_GET_BBOX"] = 0] = "FAIL_GET_BBOX";
|
|
29
|
+
WARN_TYPE[WARN_TYPE["FAIL_GET_VISIBLE"] = 1] = "FAIL_GET_VISIBLE";
|
|
30
|
+
WARN_TYPE[WARN_TYPE["FAIL_SET_STATE"] = 2] = "FAIL_SET_STATE";
|
|
31
|
+
WARN_TYPE[WARN_TYPE["FAIL_GET_STATE"] = 3] = "FAIL_GET_STATE";
|
|
32
|
+
WARN_TYPE[WARN_TYPE["FAIL_SET_VISIBLE"] = 4] = "FAIL_SET_VISIBLE";
|
|
33
|
+
WARN_TYPE[WARN_TYPE["FAIL_DRAW_TRANSIENT"] = 5] = "FAIL_DRAW_TRANSIENT";
|
|
34
|
+
WARN_TYPE[WARN_TYPE["SOURCE_NOT_EXIST"] = 6] = "SOURCE_NOT_EXIST";
|
|
35
|
+
WARN_TYPE[WARN_TYPE["TARGET_NOT_EXIST"] = 7] = "TARGET_NOT_EXIST";
|
|
36
|
+
})(WARN_TYPE || (WARN_TYPE = {}));
|
|
37
|
+
const getWarnMsg = {
|
|
38
|
+
[WARN_TYPE.FAIL_GET_BBOX]: (ids) => `Fail to get items' bboxes, the items with ids ${ids.join(', ')} do not exist.`,
|
|
39
|
+
[WARN_TYPE.FAIL_GET_VISIBLE]: (ids) => `Fail to get items' visible, the items with ids ${ids.join(', ')} do not exist.`,
|
|
40
|
+
[WARN_TYPE.FAIL_SET_STATE]: (ids) => `Fail to set states for items ${ids.join(', ')}, which do not exist.`,
|
|
41
|
+
[WARN_TYPE.FAIL_SET_VISIBLE]: (ids) => `Fail to set visibility for items ${ids.join(', ')}, which do not exist.`,
|
|
42
|
+
[WARN_TYPE.FAIL_DRAW_TRANSIENT]: (ids) => `Fail to draw transient items of ${ids}, which do not exist.`,
|
|
43
|
+
[WARN_TYPE.SOURCE_NOT_EXIST]: (params) => `The source nodes ${params
|
|
44
|
+
.map((p) => p.source)
|
|
45
|
+
.join(', ')} do not exist in the graph for edges ${params
|
|
46
|
+
.map((p) => p.id)
|
|
47
|
+
.join(', ')}, please add the nodes first`,
|
|
48
|
+
[WARN_TYPE.TARGET_NOT_EXIST]: (params) => `The target nodes ${params
|
|
49
|
+
.map((p) => p.target)
|
|
50
|
+
.join(', ')} do not exist in the graph for edges ${params
|
|
51
|
+
.map((p) => p.id)
|
|
52
|
+
.join(', ')}, please add the nodes first`,
|
|
53
|
+
[WARN_TYPE.FAIL_GET_STATE]: (ids) => `Fail to get items' states, the items with ids ${ids.join(', ')} do not exist.`,
|
|
54
|
+
};
|
|
26
55
|
/**
|
|
27
56
|
* Manages and stores the node / edge / combo items.
|
|
28
57
|
*/
|
|
@@ -41,26 +70,70 @@ export class ItemController {
|
|
|
41
70
|
// The G shapes or groups on transient map drawn by this controller
|
|
42
71
|
this.transientObjectMap = new Map();
|
|
43
72
|
this.transientItemMap = new Map();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
73
|
+
/** Caches */
|
|
74
|
+
this.nearEdgesCache = new Map();
|
|
75
|
+
this.cacheWarnMsg = {};
|
|
76
|
+
/**
|
|
77
|
+
* get the items inside viewport
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
this.groupItemsByView = (containType = 'inside', ratio = 1) => {
|
|
81
|
+
const range = this.graph.getCanvasRange();
|
|
82
|
+
const items = Array.from(this.itemMap, ([key, value]) => value);
|
|
83
|
+
const containFunc = containType === 'intersect' ? intersectBBox : isBBoxInBBox;
|
|
84
|
+
let { inView: itemsInView, outView: itemsOutView } = this.cacheViewItems || {};
|
|
85
|
+
if (!ratio || ratio === 1 || !this.cacheViewItems) {
|
|
86
|
+
itemsInView = [];
|
|
87
|
+
itemsOutView = [];
|
|
88
|
+
items.forEach((item) => {
|
|
53
89
|
const { keyShape } = item.shapeMap;
|
|
54
90
|
if (!keyShape)
|
|
55
91
|
return;
|
|
56
92
|
const renderBounds = keyShape.getRenderBounds();
|
|
57
|
-
if (
|
|
58
|
-
|
|
93
|
+
if (containFunc(renderBounds, range, 0.4))
|
|
94
|
+
itemsInView.push(item);
|
|
59
95
|
else
|
|
60
|
-
|
|
96
|
+
itemsOutView.push(item);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
else if (ratio < 1) {
|
|
100
|
+
// zoom-out
|
|
101
|
+
itemsOutView.forEach((item) => {
|
|
102
|
+
const { keyShape } = item.shapeMap;
|
|
103
|
+
if (!keyShape)
|
|
104
|
+
return;
|
|
105
|
+
const renderBounds = keyShape.getRenderBounds();
|
|
106
|
+
if (containFunc(renderBounds, range, 0.4)) {
|
|
107
|
+
itemsInView.push(item);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
else if (ratio > 1) {
|
|
112
|
+
// zoom-in
|
|
113
|
+
itemsInView.forEach((item) => {
|
|
114
|
+
const { keyShape } = item.shapeMap;
|
|
115
|
+
if (!keyShape)
|
|
116
|
+
return;
|
|
117
|
+
const renderBounds = keyShape.getRenderBounds();
|
|
118
|
+
if (!containFunc(renderBounds, range, 0.4)) {
|
|
119
|
+
itemsOutView.push(item);
|
|
120
|
+
}
|
|
61
121
|
});
|
|
62
|
-
|
|
63
|
-
|
|
122
|
+
}
|
|
123
|
+
this.cacheViewItems = { inView: itemsInView, outView: itemsOutView };
|
|
124
|
+
return {
|
|
125
|
+
items,
|
|
126
|
+
inView: itemsInView,
|
|
127
|
+
outView: itemsOutView,
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
this.onViewportChange = debounce(({ transform, effectTiming, tileLodSize = 1000, }) => {
|
|
131
|
+
const { zoom } = transform;
|
|
132
|
+
if (zoom) {
|
|
133
|
+
const zoomRatio = this.graph.getZoom();
|
|
134
|
+
const { items, inView: itemsInview, outView: itemsOutView, } = this.groupItemsByView();
|
|
135
|
+
const sortedItems = itemsInview.concat(itemsOutView);
|
|
136
|
+
const sections = Math.ceil(items.length / tileLodSize);
|
|
64
137
|
const itemSections = Array.from({ length: sections }, (v, i) => sortedItems.slice(i * tileLodSize, i * tileLodSize + tileLodSize));
|
|
65
138
|
let requestId;
|
|
66
139
|
const update = () => {
|
|
@@ -72,7 +145,6 @@ export class ItemController {
|
|
|
72
145
|
requestId = requestAnimationFrame(update);
|
|
73
146
|
};
|
|
74
147
|
requestId = requestAnimationFrame(update);
|
|
75
|
-
// this.itemMap.forEach((item) => item.updateZoom(zoomRatio));
|
|
76
148
|
this.zoom = zoomRatio;
|
|
77
149
|
}
|
|
78
150
|
}, 500, false);
|
|
@@ -111,6 +183,11 @@ export class ItemController {
|
|
|
111
183
|
// Fix OOM problem, since this map will hold all the refs of items.
|
|
112
184
|
this.itemMap.clear();
|
|
113
185
|
};
|
|
186
|
+
this.debounceWarn = debounce((type) => {
|
|
187
|
+
const msg = getWarnMsg[type](this.cacheWarnMsg[type]);
|
|
188
|
+
console.warn(msg);
|
|
189
|
+
this.cacheWarnMsg[type] = [];
|
|
190
|
+
}, 16, false);
|
|
114
191
|
this.graph = graph;
|
|
115
192
|
// get mapper for node / edge / combo
|
|
116
193
|
const { node, edge, combo, nodeState = {}, edgeState = {}, comboState = {}, } = graph.getSpecification();
|
|
@@ -134,6 +211,7 @@ export class ItemController {
|
|
|
134
211
|
this.graph.hooks.render.tap(this.onRender.bind(this));
|
|
135
212
|
this.graph.hooks.itemchange.tap(this.onChange.bind(this));
|
|
136
213
|
this.graph.hooks.itemstatechange.tap(this.onItemStateChange.bind(this));
|
|
214
|
+
this.graph.hooks.itemstateconfigchange.tap(this.onItemStateConfigChange.bind(this));
|
|
137
215
|
this.graph.hooks.itemvisibilitychange.tap(this.onItemVisibilityChange.bind(this));
|
|
138
216
|
this.graph.hooks.itemzindexchange.tap(this.onItemZIndexChange.bind(this));
|
|
139
217
|
this.graph.hooks.transientupdate.tap(this.onTransientUpdate.bind(this));
|
|
@@ -170,19 +248,30 @@ export class ItemController {
|
|
|
170
248
|
*/
|
|
171
249
|
onRender(param) {
|
|
172
250
|
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
-
const { graphCore, theme = {}, transientCanvas, tileOptimize = {} } = param;
|
|
251
|
+
const { graphCore, theme = {}, transientCanvas, transientLabelCanvas, tileOptimize = {}, } = param;
|
|
174
252
|
const { graph } = this;
|
|
175
253
|
// 0. clear groups on canvas, and create new groups
|
|
176
254
|
graph.canvas.removeChildren();
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
this.nodeGroup =
|
|
184
|
-
this.
|
|
185
|
-
|
|
255
|
+
graph.labelCanvas.removeChildren();
|
|
256
|
+
graph.transientCanvas.removeChildren();
|
|
257
|
+
this.itemMap.forEach((item) => item.destroy());
|
|
258
|
+
this.itemMap.clear();
|
|
259
|
+
this.comboGroup = new Group({ id: 'combo-group', style: { zIndex: 0 } });
|
|
260
|
+
this.edgeGroup = new Group({ id: 'edge-group', style: { zIndex: 1 } });
|
|
261
|
+
this.nodeGroup = new Group({ id: 'node-group', style: { zIndex: 2 } });
|
|
262
|
+
this.edgeLabelGroup = new Group({
|
|
263
|
+
id: 'node-label-group',
|
|
264
|
+
style: { zIndex: 0 },
|
|
265
|
+
});
|
|
266
|
+
this.nodeLabelGroup = new Group({
|
|
267
|
+
id: 'node-label-group',
|
|
268
|
+
style: { zIndex: 1 },
|
|
269
|
+
});
|
|
270
|
+
graph.canvas.appendChild(this.comboGroup);
|
|
271
|
+
graph.canvas.appendChild(this.edgeGroup);
|
|
272
|
+
graph.canvas.appendChild(this.nodeGroup);
|
|
273
|
+
graph.labelCanvas.appendChild(this.edgeLabelGroup);
|
|
274
|
+
graph.labelCanvas.appendChild(this.nodeLabelGroup);
|
|
186
275
|
// Also create transient groups on transient canvas.
|
|
187
276
|
transientCanvas.removeChildren();
|
|
188
277
|
this.transientComboGroup = new Group({
|
|
@@ -200,6 +289,16 @@ export class ItemController {
|
|
|
200
289
|
transientCanvas.appendChild(this.transientComboGroup);
|
|
201
290
|
transientCanvas.appendChild(this.transientEdgeGroup);
|
|
202
291
|
transientCanvas.appendChild(this.transientNodeGroup);
|
|
292
|
+
this.transientEdgeLabelGroup = new Group({
|
|
293
|
+
id: 'node-label-group',
|
|
294
|
+
style: { zIndex: 0 },
|
|
295
|
+
});
|
|
296
|
+
this.transientNodeLabelGroup = new Group({
|
|
297
|
+
id: 'node-label-group',
|
|
298
|
+
style: { zIndex: 1 },
|
|
299
|
+
});
|
|
300
|
+
transientLabelCanvas.appendChild(this.transientEdgeLabelGroup);
|
|
301
|
+
transientLabelCanvas.appendChild(this.transientNodeLabelGroup);
|
|
203
302
|
// 1. create lights for webgl 3d rendering
|
|
204
303
|
if (graph.rendererType === 'webgl-3d') {
|
|
205
304
|
const ambientLight = new AmbientLight({
|
|
@@ -323,19 +422,25 @@ export class ItemController {
|
|
|
323
422
|
const { dataTypeField: nodeDataTypeField } = nodeTheme;
|
|
324
423
|
const edgeIdsToUpdate = new Set();
|
|
325
424
|
const comboIdsToUpdate = new Set();
|
|
326
|
-
const updateRelates = (
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
425
|
+
const updateRelates = (param) => {
|
|
426
|
+
const { edgeIds, callback } = param;
|
|
427
|
+
edgeIds.forEach((nid) => {
|
|
428
|
+
const item = itemMap.get(nid);
|
|
429
|
+
if (item && !item.destroyed)
|
|
430
|
+
item.forceUpdate();
|
|
431
|
+
});
|
|
432
|
+
callback === null || callback === void 0 ? void 0 : callback();
|
|
433
|
+
};
|
|
434
|
+
const updateAllRelates = () => {
|
|
435
|
+
[...comboIdsToUpdate, ...edgeIdsToUpdate].forEach((nid) => {
|
|
331
436
|
const item = itemMap.get(nid);
|
|
332
437
|
if (item && !item.destroyed)
|
|
333
438
|
item.forceUpdate();
|
|
334
439
|
});
|
|
335
440
|
};
|
|
441
|
+
const debounceUpdateAllRelates = debounce(updateAllRelates, 16, false);
|
|
336
442
|
const debounceUpdateRelates = debounce(updateRelates, 16, false);
|
|
337
443
|
Object.values(nodeComboUpdate).forEach((updateObj) => {
|
|
338
|
-
var _a;
|
|
339
444
|
const { isReplace, previous, current, id } = updateObj;
|
|
340
445
|
if (!graphCore.hasNode(id))
|
|
341
446
|
return;
|
|
@@ -363,7 +468,7 @@ export class ItemController {
|
|
|
363
468
|
this.expandCombo(graphCore, innerModel);
|
|
364
469
|
}
|
|
365
470
|
}
|
|
366
|
-
const previousParentId = item.displayModel.data.parentId;
|
|
471
|
+
const previousParentId = item.displayModel.data.parentId || previous.parentId;
|
|
367
472
|
// update the current parent combo tree
|
|
368
473
|
// if the node has previous parent, related previous parent combo should be updated to
|
|
369
474
|
if (upsertAncestors) {
|
|
@@ -403,15 +508,19 @@ export class ItemController {
|
|
|
403
508
|
previous[nodeDataTypeField] !== current[nodeDataTypeField]) {
|
|
404
509
|
itemTheme = getItemTheme(this.nodeDataTypeSet, nodeDataTypeField, current[nodeDataTypeField], nodeTheme);
|
|
405
510
|
}
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
511
|
+
const adjacentEdgeInnerModels = graphCore.getRelatedEdges(id);
|
|
512
|
+
if (isPointPreventPolylineOverlap(innerModel)) {
|
|
513
|
+
const newNearEdges = this.graph.getNearEdgesData(id, (edge) => isPolylineWithObstacleAvoidance(edge));
|
|
514
|
+
const prevNearEdges = this.nearEdgesCache.get(id) || [];
|
|
515
|
+
adjacentEdgeInnerModels.push(...newNearEdges);
|
|
516
|
+
adjacentEdgeInnerModels.push(...prevNearEdges);
|
|
517
|
+
this.nearEdgesCache.set(id, newNearEdges);
|
|
518
|
+
}
|
|
519
|
+
adjacentEdgeInnerModels.forEach((edge) => {
|
|
411
520
|
edgeIdsToUpdate.add(edge.id);
|
|
412
521
|
nodeRelatedIdsToUpdate.add(edge.id);
|
|
413
522
|
});
|
|
414
|
-
item.onframe = () => updateRelates(nodeRelatedIdsToUpdate);
|
|
523
|
+
item.onframe = () => updateRelates({ edgeIds: nodeRelatedIdsToUpdate });
|
|
415
524
|
let statesCache;
|
|
416
525
|
if (innerModel.data._isCombo &&
|
|
417
526
|
previous.collapsed !== current.collapsed) {
|
|
@@ -420,26 +529,25 @@ export class ItemController {
|
|
|
420
529
|
}
|
|
421
530
|
item.update(innerModel, { previous, current }, isReplace, itemTheme, onlyMove, animate,
|
|
422
531
|
// call after updating finished
|
|
423
|
-
|
|
424
|
-
var _a;
|
|
425
|
-
(_a = item.onframe) === null || _a === void 0 ? void 0 : _a.call(item, true);
|
|
532
|
+
(_, canceled) => {
|
|
426
533
|
item.onframe = undefined;
|
|
427
534
|
if (statesCache) {
|
|
428
535
|
statesCache.forEach((state) => this.graph.setItemState(id, state, true));
|
|
429
536
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
537
|
+
// @ts-ignore
|
|
538
|
+
debounceUpdateRelates({
|
|
539
|
+
edgeIds: nodeRelatedIdsToUpdate,
|
|
540
|
+
callback: () => callback(innerModel, canceled),
|
|
541
|
+
});
|
|
542
|
+
});
|
|
435
543
|
const parentItem = this.itemMap.get(current.parentId);
|
|
436
544
|
if (current.parentId && (parentItem === null || parentItem === void 0 ? void 0 : parentItem.model.data.collapsed)) {
|
|
437
545
|
this.graph.executeWithNoStack(() => {
|
|
438
|
-
this.graph.hideItem(innerModel.id, false);
|
|
546
|
+
this.graph.hideItem(innerModel.id, { disableAnimate: false });
|
|
439
547
|
});
|
|
440
548
|
}
|
|
441
549
|
});
|
|
442
|
-
|
|
550
|
+
debounceUpdateAllRelates();
|
|
443
551
|
}
|
|
444
552
|
// === 6. update edges' data ===
|
|
445
553
|
if (groupedChanges.EdgeDataUpdated.length) {
|
|
@@ -505,7 +613,7 @@ export class ItemController {
|
|
|
505
613
|
let parent = graphCore.getParent(nodeId, 'tree');
|
|
506
614
|
while (parent) {
|
|
507
615
|
if (parent.data.collapsed) {
|
|
508
|
-
this.graph.hideItem(nodeId, true);
|
|
616
|
+
this.graph.hideItem(nodeId, { disableAnimate: true });
|
|
509
617
|
break;
|
|
510
618
|
}
|
|
511
619
|
parent = graphCore.getParent(parent.id, 'tree');
|
|
@@ -527,7 +635,11 @@ export class ItemController {
|
|
|
527
635
|
ids.forEach((id) => {
|
|
528
636
|
const item = this.itemMap.get(id);
|
|
529
637
|
if (!item) {
|
|
530
|
-
|
|
638
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_STATE] =
|
|
639
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_STATE] || [];
|
|
640
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_STATE].push(id);
|
|
641
|
+
// @ts-ignore
|
|
642
|
+
this.debounceWarn(WARN_TYPE.FAIL_SET_STATE);
|
|
531
643
|
return;
|
|
532
644
|
}
|
|
533
645
|
if (!states || !value) {
|
|
@@ -539,18 +651,43 @@ export class ItemController {
|
|
|
539
651
|
}
|
|
540
652
|
});
|
|
541
653
|
}
|
|
654
|
+
onItemStateConfigChange(param) {
|
|
655
|
+
const { itemType, stateConfig } = param;
|
|
656
|
+
const fieldName = `${itemType}StateMapper`;
|
|
657
|
+
this[fieldName] = stateConfig;
|
|
658
|
+
this.graph.getAllNodesData().forEach((node) => {
|
|
659
|
+
const item = this.itemMap.get(node.id);
|
|
660
|
+
if (item) {
|
|
661
|
+
item.stateMapper = stateConfig;
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
}
|
|
542
665
|
onItemVisibilityChange(param) {
|
|
543
|
-
const { ids, value, graphCore, animate = true, keepKeyShape = false, } = param;
|
|
666
|
+
const { ids, shapeIds, value, graphCore, animate = true, keepKeyShape = false, keepRelated = false, } = param;
|
|
544
667
|
ids.forEach((id) => {
|
|
545
668
|
const item = this.itemMap.get(id);
|
|
546
669
|
if (!item) {
|
|
547
|
-
|
|
670
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_VISIBLE] =
|
|
671
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_VISIBLE] || [];
|
|
672
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_VISIBLE].push(id);
|
|
673
|
+
// @ts-ignore
|
|
674
|
+
this.debounceWarn(WARN_TYPE.FAIL_SET_VISIBLE);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
if (shapeIds === null || shapeIds === void 0 ? void 0 : shapeIds.length) {
|
|
678
|
+
if (value) {
|
|
679
|
+
item.show(animate, shapeIds);
|
|
680
|
+
}
|
|
681
|
+
else {
|
|
682
|
+
item.hide(animate, false, shapeIds);
|
|
683
|
+
}
|
|
548
684
|
return;
|
|
549
685
|
}
|
|
550
686
|
const type = item.getType();
|
|
551
687
|
if (value) {
|
|
552
688
|
if (type === 'edge') {
|
|
553
689
|
item.show(animate);
|
|
690
|
+
item.forceUpdate();
|
|
554
691
|
}
|
|
555
692
|
else {
|
|
556
693
|
if (graphCore.hasTreeStructure('combo')) {
|
|
@@ -574,7 +711,7 @@ export class ItemController {
|
|
|
574
711
|
}
|
|
575
712
|
else {
|
|
576
713
|
item.hide(animate, keepKeyShape);
|
|
577
|
-
if (type !== 'edge') {
|
|
714
|
+
if (type !== 'edge' && !keepRelated) {
|
|
578
715
|
const relatedEdges = graphCore.getRelatedEdges(id);
|
|
579
716
|
relatedEdges.forEach(({ id: edgeId }) => {
|
|
580
717
|
var _a;
|
|
@@ -653,10 +790,14 @@ export class ItemController {
|
|
|
653
790
|
if (isItemType) {
|
|
654
791
|
const item = this.itemMap.get(id);
|
|
655
792
|
if (!item) {
|
|
656
|
-
|
|
793
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_DRAW_TRANSIENT] =
|
|
794
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_DRAW_TRANSIENT] || [];
|
|
795
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_DRAW_TRANSIENT].push(id);
|
|
796
|
+
// @ts-ignore
|
|
797
|
+
this.debounceWarn(WARN_TYPE.FAIL_DRAW_TRANSIENT);
|
|
657
798
|
return;
|
|
658
799
|
}
|
|
659
|
-
const transientItem = upsertTransientItem(item, this.transientNodeGroup, this.transientEdgeGroup, this.transientComboGroup, this.transientItemMap, this.itemMap, graphCore, { shapeIds, drawSource, drawTarget, visible }, upsertAncestors);
|
|
800
|
+
const transientItem = upsertTransientItem(item, this.transientNodeGroup, this.transientEdgeGroup, this.transientComboGroup, this.transientNodeLabelGroup, this.transientEdgeLabelGroup, this.transientItemMap, this.itemMap, graphCore, { shapeIds, drawSource, drawTarget, visible }, upsertAncestors);
|
|
660
801
|
if (shapeIds) {
|
|
661
802
|
// only update node positions to cloned node container(group)
|
|
662
803
|
if ((type === 'node' || type === 'combo') &&
|
|
@@ -699,11 +840,21 @@ export class ItemController {
|
|
|
699
840
|
}
|
|
700
841
|
// Update the target combo's posiiton and other props
|
|
701
842
|
transItem.update(Object.assign(Object.assign({}, transItem.model), { data: Object.assign(Object.assign({}, transItem.model.data), data) }));
|
|
843
|
+
if (type !== 'edge') {
|
|
844
|
+
const relatedEdges = graphCore.getRelatedEdges(transItem.model.id);
|
|
845
|
+
relatedEdges.forEach((relatedEdge) => {
|
|
846
|
+
const transientEdge = this.transientItemMap.get(relatedEdge.id);
|
|
847
|
+
if (transientEdge)
|
|
848
|
+
transientEdge.forceUpdate();
|
|
849
|
+
});
|
|
850
|
+
}
|
|
702
851
|
}
|
|
703
852
|
return;
|
|
704
853
|
}
|
|
705
854
|
const idStr = String(id);
|
|
706
|
-
const shape = upsertShape(type, idStr, style,
|
|
855
|
+
const shape = upsertShape(type, idStr, style, {
|
|
856
|
+
shapeMap: Object.fromEntries(transientObjectMap),
|
|
857
|
+
});
|
|
707
858
|
transientObjectMap.set(idStr, shape);
|
|
708
859
|
shape.style.pointerEvents = capture ? 'auto' : 'none';
|
|
709
860
|
if (shape.parentNode === null)
|
|
@@ -713,19 +864,27 @@ export class ItemController {
|
|
|
713
864
|
return this.transientObjectMap.get(id);
|
|
714
865
|
}
|
|
715
866
|
getTransientItem(id) {
|
|
716
|
-
return this.transientItemMap
|
|
867
|
+
return this.transientItemMap.get(id);
|
|
868
|
+
}
|
|
869
|
+
getItemMap() {
|
|
870
|
+
return this.itemMap;
|
|
717
871
|
}
|
|
718
872
|
findDisplayModel(id) {
|
|
719
|
-
|
|
720
|
-
|
|
873
|
+
const item = this.itemMap.get(id);
|
|
874
|
+
if (!item)
|
|
875
|
+
return { id, data: {} };
|
|
876
|
+
return {
|
|
877
|
+
id,
|
|
878
|
+
data: Object.assign(Object.assign(Object.assign({}, item.displayModel.data), item.renderExt.mergedStyles), { lodLevels: item.lodLevels }),
|
|
879
|
+
};
|
|
721
880
|
}
|
|
722
881
|
/**
|
|
723
882
|
* Create nodes with inner data to canvas.
|
|
724
|
-
* @param models nodes' inner
|
|
883
|
+
* @param models nodes' inner data
|
|
725
884
|
*/
|
|
726
885
|
renderNodes(models, nodeTheme = {}, tileOptimize) {
|
|
727
886
|
return __awaiter(this, void 0, void 0, function* () {
|
|
728
|
-
const { nodeExtensions, nodeGroup, nodeDataTypeSet, graph } = this;
|
|
887
|
+
const { nodeExtensions, nodeGroup, nodeLabelGroup, nodeDataTypeSet, graph, } = this;
|
|
729
888
|
const { dataTypeField = '' } = nodeTheme;
|
|
730
889
|
const { tileFirstRender, tileFirstRenderSize = 1000 } = tileOptimize || {};
|
|
731
890
|
const zoom = graph.getZoom();
|
|
@@ -742,10 +901,12 @@ export class ItemController {
|
|
|
742
901
|
dataType = node.data[dataTypeField];
|
|
743
902
|
const itemTheme = getItemTheme(nodeDataTypeSet, dataTypeField, dataType, nodeTheme);
|
|
744
903
|
const nodeItem = new Node({
|
|
904
|
+
graph,
|
|
745
905
|
delayFirstDraw,
|
|
746
906
|
model: node,
|
|
747
907
|
renderExtensions: nodeExtensions,
|
|
748
908
|
containerGroup: nodeGroup,
|
|
909
|
+
labelContainerGroup: nodeLabelGroup,
|
|
749
910
|
mapper: this.nodeMapper,
|
|
750
911
|
stateMapper: this.nodeStateMapper,
|
|
751
912
|
zoom,
|
|
@@ -810,10 +971,12 @@ export class ItemController {
|
|
|
810
971
|
};
|
|
811
972
|
const comboItem = new Combo({
|
|
812
973
|
model: combo,
|
|
974
|
+
graph: this.graph,
|
|
813
975
|
getCombinedBounds,
|
|
814
976
|
getChildren,
|
|
815
977
|
renderExtensions: comboExtensions,
|
|
816
978
|
containerGroup: comboGroup,
|
|
979
|
+
labelContainerGroup: this.nodeLabelGroup,
|
|
817
980
|
mapper: this.comboMapper,
|
|
818
981
|
stateMapper: this.comboStateMapper,
|
|
819
982
|
zoom,
|
|
@@ -833,10 +996,10 @@ export class ItemController {
|
|
|
833
996
|
}
|
|
834
997
|
/**
|
|
835
998
|
* Create edges with inner data to canvas.
|
|
836
|
-
* @param models edges' inner
|
|
999
|
+
* @param models edges' inner data
|
|
837
1000
|
*/
|
|
838
1001
|
renderEdges(models, edgeTheme = {}, tileOptimize, nodesInView) {
|
|
839
|
-
const { edgeExtensions, edgeGroup, itemMap, edgeDataTypeSet, graph } = this;
|
|
1002
|
+
const { edgeExtensions, edgeGroup, edgeLabelGroup, itemMap, edgeDataTypeSet, graph, } = this;
|
|
840
1003
|
const { dataTypeField = '' } = edgeTheme;
|
|
841
1004
|
const { tileFirstRender, tileFirstRenderSize = 1000 } = tileOptimize || {};
|
|
842
1005
|
const zoom = graph.getZoom();
|
|
@@ -852,11 +1015,19 @@ export class ItemController {
|
|
|
852
1015
|
const sourceItem = itemMap.get(source);
|
|
853
1016
|
const targetItem = itemMap.get(target);
|
|
854
1017
|
if (!sourceItem) {
|
|
855
|
-
|
|
1018
|
+
this.cacheWarnMsg[WARN_TYPE.SOURCE_NOT_EXIST] =
|
|
1019
|
+
this.cacheWarnMsg[WARN_TYPE.SOURCE_NOT_EXIST] || [];
|
|
1020
|
+
this.cacheWarnMsg[WARN_TYPE.SOURCE_NOT_EXIST].push({ id, source });
|
|
1021
|
+
// @ts-ignore
|
|
1022
|
+
this.debounceWarn(WARN_TYPE.SOURCE_NOT_EXIST);
|
|
856
1023
|
return;
|
|
857
1024
|
}
|
|
858
1025
|
if (!targetItem) {
|
|
859
|
-
|
|
1026
|
+
this.cacheWarnMsg[WARN_TYPE.TARGET_NOT_EXIST] =
|
|
1027
|
+
this.cacheWarnMsg[WARN_TYPE.TARGET_NOT_EXIST] || [];
|
|
1028
|
+
this.cacheWarnMsg[WARN_TYPE.TARGET_NOT_EXIST].push({ id, source });
|
|
1029
|
+
// @ts-ignore
|
|
1030
|
+
this.debounceWarn(WARN_TYPE.TARGET_NOT_EXIST);
|
|
860
1031
|
return;
|
|
861
1032
|
}
|
|
862
1033
|
// get the base styles from theme
|
|
@@ -865,10 +1036,12 @@ export class ItemController {
|
|
|
865
1036
|
dataType = edge.data[dataTypeField];
|
|
866
1037
|
const itemTheme = getItemTheme(edgeDataTypeSet, dataTypeField, dataType, edgeTheme);
|
|
867
1038
|
const edgeItem = new Edge({
|
|
1039
|
+
graph,
|
|
868
1040
|
delayFirstDraw,
|
|
869
1041
|
model: edge,
|
|
870
1042
|
renderExtensions: edgeExtensions,
|
|
871
1043
|
containerGroup: edgeGroup,
|
|
1044
|
+
labelContainerGroup: edgeLabelGroup,
|
|
872
1045
|
mapper: this.edgeMapper,
|
|
873
1046
|
stateMapper: this.edgeStateMapper,
|
|
874
1047
|
sourceItem,
|
|
@@ -928,7 +1101,11 @@ export class ItemController {
|
|
|
928
1101
|
getItemState(id, state) {
|
|
929
1102
|
const item = this.itemMap.get(id);
|
|
930
1103
|
if (!item) {
|
|
931
|
-
|
|
1104
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] =
|
|
1105
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] || [];
|
|
1106
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE].push(id);
|
|
1107
|
+
// @ts-ignore
|
|
1108
|
+
this.debounceWarn(WARN_TYPE.FAIL_GET_STATE);
|
|
932
1109
|
return false;
|
|
933
1110
|
}
|
|
934
1111
|
return item.hasState(state);
|
|
@@ -936,7 +1113,11 @@ export class ItemController {
|
|
|
936
1113
|
getItemAllStates(id) {
|
|
937
1114
|
const item = this.itemMap.get(id);
|
|
938
1115
|
if (!item) {
|
|
939
|
-
|
|
1116
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] =
|
|
1117
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] || [];
|
|
1118
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE].push(id);
|
|
1119
|
+
// @ts-ignore
|
|
1120
|
+
this.debounceWarn(WARN_TYPE.FAIL_GET_STATE);
|
|
940
1121
|
return [];
|
|
941
1122
|
}
|
|
942
1123
|
return item
|
|
@@ -952,54 +1133,39 @@ export class ItemController {
|
|
|
952
1133
|
? this.transientItemMap.get(id)
|
|
953
1134
|
: this.itemMap.get(id);
|
|
954
1135
|
if (!item) {
|
|
955
|
-
|
|
1136
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_BBOX] =
|
|
1137
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_BBOX] || [];
|
|
1138
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_BBOX].push(id);
|
|
1139
|
+
// @ts-ignore
|
|
1140
|
+
this.debounceWarn(WARN_TYPE.FAIL_GET_BBOX);
|
|
956
1141
|
return false;
|
|
957
1142
|
}
|
|
958
1143
|
if (item instanceof Group)
|
|
959
1144
|
return item.getRenderBounds();
|
|
960
1145
|
return isKeyShape ? item.getKeyBBox() : item.getBBox();
|
|
961
1146
|
}
|
|
1147
|
+
getItemVisibleShapeIds(id) {
|
|
1148
|
+
const item = this.itemMap.get(id);
|
|
1149
|
+
const shapeIds = [];
|
|
1150
|
+
Object.keys(item.shapeMap).forEach((shapeId) => {
|
|
1151
|
+
var _a;
|
|
1152
|
+
if (((_a = item.shapeMap[shapeId]) === null || _a === void 0 ? void 0 : _a.attributes.visibility) !== 'hidden')
|
|
1153
|
+
shapeIds.push(shapeId);
|
|
1154
|
+
});
|
|
1155
|
+
return shapeIds;
|
|
1156
|
+
}
|
|
962
1157
|
getItemVisible(id) {
|
|
963
1158
|
const item = this.itemMap.get(id);
|
|
964
1159
|
if (!item) {
|
|
965
|
-
|
|
1160
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_VISIBLE] =
|
|
1161
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_VISIBLE] || [];
|
|
1162
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_VISIBLE].push(id);
|
|
1163
|
+
// @ts-ignore
|
|
1164
|
+
this.debounceWarn(WARN_TYPE.FAIL_GET_VISIBLE);
|
|
966
1165
|
return false;
|
|
967
1166
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
/**
|
|
971
|
-
* Identify edges that are intersected by a particular node
|
|
972
|
-
* @param nodeId node id
|
|
973
|
-
* @param graphCore
|
|
974
|
-
* @returns
|
|
975
|
-
*/
|
|
976
|
-
findNearEdgesByNode(nodeId, graphCore) {
|
|
977
|
-
var _a;
|
|
978
|
-
const edges = graphCore.getAllEdges();
|
|
979
|
-
const canvasBBox = this.graph.getRenderBBox(undefined);
|
|
980
|
-
const quadTree = new QuadTree(canvasBBox, 4);
|
|
981
|
-
each(edges, (edge) => {
|
|
982
|
-
const { data: { x: sourceX, y: sourceY }, } = graphCore.getNode(edge.source);
|
|
983
|
-
const { data: { x: targetX, y: targetY }, } = graphCore.getNode(edge.target);
|
|
984
|
-
quadTree.insert({
|
|
985
|
-
id: edge.id,
|
|
986
|
-
p1: { x: sourceX, y: sourceY },
|
|
987
|
-
p2: { x: targetX, y: targetY },
|
|
988
|
-
bbox: this.graph.getRenderBBox(edge.id),
|
|
989
|
-
});
|
|
990
|
-
});
|
|
991
|
-
// update node position
|
|
992
|
-
const node = (this.getTransientItem(nodeId) ||
|
|
993
|
-
this.getItemById(nodeId));
|
|
994
|
-
const nodeBBox = this.graph.getRenderBBox(nodeId);
|
|
995
|
-
const nodeData = (_a = node === null || node === void 0 ? void 0 : node.model) === null || _a === void 0 ? void 0 : _a.data;
|
|
996
|
-
if (nodeData) {
|
|
997
|
-
nodeBBox.update([nodeData.x, nodeData.y, 0], nodeBBox.halfExtents);
|
|
998
|
-
}
|
|
999
|
-
const checker = new EdgeCollisionChecker(quadTree);
|
|
1000
|
-
const collisions = checker.getCollidingEdges(nodeBBox);
|
|
1001
|
-
const collidingEdges = map(collisions, (collision) => graphCore.getEdge(collision.id));
|
|
1002
|
-
return collidingEdges;
|
|
1167
|
+
const transientVisible = this.transientItemMap.get(id);
|
|
1168
|
+
return item.isVisible() || (transientVisible === null || transientVisible === void 0 ? void 0 : transientVisible.isVisible());
|
|
1003
1169
|
}
|
|
1004
1170
|
sortByComboTree(graphCore) {
|
|
1005
1171
|
if (!graphCore.hasTreeStructure('combo'))
|
|
@@ -1018,7 +1184,7 @@ export class ItemController {
|
|
|
1018
1184
|
graphComboTreeDfs(this.graph, [comboModel], (child) => {
|
|
1019
1185
|
if (child.id !== comboModel.id) {
|
|
1020
1186
|
this.graph.executeWithNoStack(() => {
|
|
1021
|
-
this.graph.hideItem(child.id, false);
|
|
1187
|
+
this.graph.hideItem(child.id, { disableAnimate: false });
|
|
1022
1188
|
});
|
|
1023
1189
|
}
|
|
1024
1190
|
relatedEdges = relatedEdges.concat(graphCore.getRelatedEdges(child.id));
|
|
@@ -1172,8 +1338,10 @@ export class ItemController {
|
|
|
1172
1338
|
if (!positions.length)
|
|
1173
1339
|
return;
|
|
1174
1340
|
this.graph.updateNodePosition(positions, undefined, !animate, (model, canceled) => {
|
|
1175
|
-
|
|
1176
|
-
|
|
1341
|
+
positions.forEach((position) => {
|
|
1342
|
+
this.graph.hideItem(position.id, { disableAnimate: canceled });
|
|
1343
|
+
});
|
|
1344
|
+
});
|
|
1177
1345
|
}
|
|
1178
1346
|
/**
|
|
1179
1347
|
* Expand sub tree(s).
|
|
@@ -1203,20 +1371,20 @@ export class ItemController {
|
|
|
1203
1371
|
allNodeIds = allNodeIds.concat(nodeIds.filter((id) => id !== root.id));
|
|
1204
1372
|
});
|
|
1205
1373
|
const ids = uniq(allNodeIds.concat(allEdgeIds));
|
|
1206
|
-
this.graph.showItem(ids, !animate);
|
|
1374
|
+
this.graph.showItem(ids, { disableAnimate: !animate });
|
|
1207
1375
|
yield this.graph.layout(undefined, !animate);
|
|
1208
1376
|
});
|
|
1209
1377
|
}
|
|
1210
1378
|
}
|
|
1211
1379
|
const getItemTheme = (dataTypeSet, dataTypeField, dataType, itemTheme) => {
|
|
1212
|
-
const { styles: themeStyles = [],
|
|
1213
|
-
const
|
|
1380
|
+
const { styles: themeStyles = [], lodLevels } = itemTheme;
|
|
1381
|
+
const formattedLodLevels = formatLodLevels(lodLevels);
|
|
1214
1382
|
if (!dataTypeField) {
|
|
1215
1383
|
// dataType field is not assigned
|
|
1216
1384
|
const styles = isArray(themeStyles)
|
|
1217
1385
|
? themeStyles[0]
|
|
1218
1386
|
: Object.values(themeStyles)[0];
|
|
1219
|
-
return { styles,
|
|
1387
|
+
return { styles, lodLevels: formattedLodLevels };
|
|
1220
1388
|
}
|
|
1221
1389
|
dataTypeSet.add(dataType);
|
|
1222
1390
|
let themeStyle;
|
|
@@ -1232,7 +1400,7 @@ const getItemTheme = (dataTypeSet, dataTypeField, dataType, itemTheme) => {
|
|
|
1232
1400
|
}
|
|
1233
1401
|
return {
|
|
1234
1402
|
styles: themeStyle,
|
|
1235
|
-
|
|
1403
|
+
lodLevels: formattedLodLevels,
|
|
1236
1404
|
};
|
|
1237
1405
|
};
|
|
1238
1406
|
const filterItemMapByType = (itemMap, type) => {
|