@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
|
@@ -20,26 +20,36 @@ import {
|
|
|
20
20
|
NodeDisplayModel,
|
|
21
21
|
NodeEncode,
|
|
22
22
|
NodeModelData,
|
|
23
|
+
NodeShapesEncode,
|
|
23
24
|
} from '../../types';
|
|
24
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
ComboDisplayModel,
|
|
27
|
+
ComboEncode,
|
|
28
|
+
ComboShapesEncode,
|
|
29
|
+
} from '../../types/combo';
|
|
25
30
|
import { GraphCore } from '../../types/data';
|
|
26
31
|
import {
|
|
27
32
|
EdgeDisplayModel,
|
|
28
33
|
EdgeEncode,
|
|
29
34
|
EdgeModel,
|
|
30
35
|
EdgeModelData,
|
|
36
|
+
EdgeShapesEncode,
|
|
31
37
|
} from '../../types/edge';
|
|
32
38
|
import Node from '../../item/node';
|
|
33
39
|
import Edge from '../../item/edge';
|
|
34
40
|
import Combo from '../../item/combo';
|
|
35
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
getCombinedBoundsByData,
|
|
43
|
+
intersectBBox,
|
|
44
|
+
upsertShape,
|
|
45
|
+
} from '../../util/shape';
|
|
36
46
|
import { getExtension } from '../../util/extension';
|
|
37
47
|
import { upsertTransientItem } from '../../util/item';
|
|
38
48
|
import {
|
|
39
49
|
ITEM_TYPE,
|
|
40
50
|
ShapeStyle,
|
|
41
51
|
SHAPE_TYPE,
|
|
42
|
-
|
|
52
|
+
LodLevelRanges,
|
|
43
53
|
DisplayMapper,
|
|
44
54
|
} from '../../types/item';
|
|
45
55
|
import {
|
|
@@ -52,7 +62,7 @@ import {
|
|
|
52
62
|
ComboStyleSet,
|
|
53
63
|
} from '../../types/theme';
|
|
54
64
|
import { ViewportChangeHookParams } from '../../types/hook';
|
|
55
|
-
import {
|
|
65
|
+
import { formatLodLevels } from '../../util/zoom';
|
|
56
66
|
import {
|
|
57
67
|
deconstructData,
|
|
58
68
|
graphComboTreeDfs,
|
|
@@ -64,10 +74,56 @@ import {
|
|
|
64
74
|
import { getGroupedChanges } from '../../util/event';
|
|
65
75
|
import { BaseNode } from '../../stdlib/item/node/base';
|
|
66
76
|
import { BaseEdge } from '../../stdlib/item/edge/base';
|
|
67
|
-
import { EdgeCollisionChecker, QuadTree } from '../../util/polyline';
|
|
68
77
|
import { isBBoxInBBox, isPointInBBox } from '../../util/bbox';
|
|
69
78
|
import { convertToNumber } from '../../util/type';
|
|
79
|
+
import {
|
|
80
|
+
isPointPreventPolylineOverlap,
|
|
81
|
+
isPolylineWithObstacleAvoidance,
|
|
82
|
+
} from '../../util/polyline';
|
|
83
|
+
|
|
84
|
+
enum WARN_TYPE {
|
|
85
|
+
FAIL_GET_BBOX,
|
|
86
|
+
FAIL_GET_VISIBLE,
|
|
87
|
+
FAIL_SET_STATE,
|
|
88
|
+
FAIL_GET_STATE,
|
|
89
|
+
FAIL_SET_VISIBLE,
|
|
90
|
+
FAIL_DRAW_TRANSIENT,
|
|
91
|
+
SOURCE_NOT_EXIST,
|
|
92
|
+
TARGET_NOT_EXIST,
|
|
93
|
+
}
|
|
70
94
|
|
|
95
|
+
const getWarnMsg = {
|
|
96
|
+
[WARN_TYPE.FAIL_GET_BBOX]: (ids) =>
|
|
97
|
+
`Fail to get items' bboxes, the items with ids ${ids.join(
|
|
98
|
+
', ',
|
|
99
|
+
)} do not exist.`,
|
|
100
|
+
[WARN_TYPE.FAIL_GET_VISIBLE]: (ids) =>
|
|
101
|
+
`Fail to get items' visible, the items with ids ${ids.join(
|
|
102
|
+
', ',
|
|
103
|
+
)} do not exist.`,
|
|
104
|
+
[WARN_TYPE.FAIL_SET_STATE]: (ids) =>
|
|
105
|
+
`Fail to set states for items ${ids.join(', ')}, which do not exist.`,
|
|
106
|
+
[WARN_TYPE.FAIL_SET_VISIBLE]: (ids) =>
|
|
107
|
+
`Fail to set visibility for items ${ids.join(', ')}, which do not exist.`,
|
|
108
|
+
[WARN_TYPE.FAIL_DRAW_TRANSIENT]: (ids) =>
|
|
109
|
+
`Fail to draw transient items of ${ids}, which do not exist.`,
|
|
110
|
+
[WARN_TYPE.SOURCE_NOT_EXIST]: (params) =>
|
|
111
|
+
`The source nodes ${params
|
|
112
|
+
.map((p) => p.source)
|
|
113
|
+
.join(', ')} do not exist in the graph for edges ${params
|
|
114
|
+
.map((p) => p.id)
|
|
115
|
+
.join(', ')}, please add the nodes first`,
|
|
116
|
+
[WARN_TYPE.TARGET_NOT_EXIST]: (params) =>
|
|
117
|
+
`The target nodes ${params
|
|
118
|
+
.map((p) => p.target)
|
|
119
|
+
.join(', ')} do not exist in the graph for edges ${params
|
|
120
|
+
.map((p) => p.id)
|
|
121
|
+
.join(', ')}, please add the nodes first`,
|
|
122
|
+
[WARN_TYPE.FAIL_GET_STATE]: (ids) =>
|
|
123
|
+
`Fail to get items' states, the items with ids ${ids.join(
|
|
124
|
+
', ',
|
|
125
|
+
)} do not exist.`,
|
|
126
|
+
};
|
|
71
127
|
/**
|
|
72
128
|
* Manages and stores the node / edge / combo items.
|
|
73
129
|
*/
|
|
@@ -117,11 +173,15 @@ export class ItemController {
|
|
|
117
173
|
|
|
118
174
|
// if the graph has combos, nodeGroup/edgeGroup/comboGroup point to the same group, so as transient groups.
|
|
119
175
|
private nodeGroup: Group;
|
|
176
|
+
private nodeLabelGroup: Group;
|
|
177
|
+
private edgeLabelGroup: Group;
|
|
120
178
|
private edgeGroup: Group;
|
|
121
179
|
private comboGroup: Group;
|
|
122
180
|
private transientNodeGroup: Group;
|
|
123
181
|
private transientEdgeGroup: Group;
|
|
124
182
|
private transientComboGroup: Group;
|
|
183
|
+
private transientNodeLabelGroup: Group;
|
|
184
|
+
private transientEdgeLabelGroup: Group;
|
|
125
185
|
|
|
126
186
|
private nodeDataTypeSet: Set<string> = new Set();
|
|
127
187
|
private edgeDataTypeSet: Set<string> = new Set();
|
|
@@ -136,6 +196,15 @@ export class ItemController {
|
|
|
136
196
|
ID,
|
|
137
197
|
Node | Edge | Combo | Group
|
|
138
198
|
>();
|
|
199
|
+
/** Caches */
|
|
200
|
+
private nearEdgesCache: Map<ID, EdgeModel[]> = new Map<ID, EdgeModel[]>();
|
|
201
|
+
|
|
202
|
+
private cacheViewItems: {
|
|
203
|
+
inView: (Node | Edge | Combo)[];
|
|
204
|
+
outView: (Node | Edge | Combo)[];
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
private cacheWarnMsg = {};
|
|
139
208
|
|
|
140
209
|
constructor(graph: IGraph<any, any>) {
|
|
141
210
|
this.graph = graph;
|
|
@@ -170,6 +239,9 @@ export class ItemController {
|
|
|
170
239
|
this.graph.hooks.render.tap(this.onRender.bind(this));
|
|
171
240
|
this.graph.hooks.itemchange.tap(this.onChange.bind(this));
|
|
172
241
|
this.graph.hooks.itemstatechange.tap(this.onItemStateChange.bind(this));
|
|
242
|
+
this.graph.hooks.itemstateconfigchange.tap(
|
|
243
|
+
this.onItemStateConfigChange.bind(this),
|
|
244
|
+
);
|
|
173
245
|
this.graph.hooks.itemvisibilitychange.tap(
|
|
174
246
|
this.onItemVisibilityChange.bind(this),
|
|
175
247
|
);
|
|
@@ -215,25 +287,43 @@ export class ItemController {
|
|
|
215
287
|
graphCore: GraphCore;
|
|
216
288
|
theme: ThemeSpecification;
|
|
217
289
|
transientCanvas: Canvas;
|
|
290
|
+
transientLabelCanvas: Canvas;
|
|
218
291
|
tileOptimize?: {
|
|
219
292
|
tileFirstRender?: boolean | number;
|
|
220
293
|
tileFirstRenderSize?: number;
|
|
221
294
|
};
|
|
222
295
|
}) {
|
|
223
|
-
const {
|
|
296
|
+
const {
|
|
297
|
+
graphCore,
|
|
298
|
+
theme = {},
|
|
299
|
+
transientCanvas,
|
|
300
|
+
transientLabelCanvas,
|
|
301
|
+
tileOptimize = {},
|
|
302
|
+
} = param;
|
|
224
303
|
const { graph } = this;
|
|
225
304
|
|
|
226
305
|
// 0. clear groups on canvas, and create new groups
|
|
227
306
|
graph.canvas.removeChildren();
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
this.nodeGroup =
|
|
235
|
-
this.
|
|
236
|
-
|
|
307
|
+
graph.labelCanvas.removeChildren();
|
|
308
|
+
graph.transientCanvas.removeChildren();
|
|
309
|
+
this.itemMap.forEach((item) => item.destroy());
|
|
310
|
+
this.itemMap.clear();
|
|
311
|
+
this.comboGroup = new Group({ id: 'combo-group', style: { zIndex: 0 } });
|
|
312
|
+
this.edgeGroup = new Group({ id: 'edge-group', style: { zIndex: 1 } });
|
|
313
|
+
this.nodeGroup = new Group({ id: 'node-group', style: { zIndex: 2 } });
|
|
314
|
+
this.edgeLabelGroup = new Group({
|
|
315
|
+
id: 'node-label-group',
|
|
316
|
+
style: { zIndex: 0 },
|
|
317
|
+
});
|
|
318
|
+
this.nodeLabelGroup = new Group({
|
|
319
|
+
id: 'node-label-group',
|
|
320
|
+
style: { zIndex: 1 },
|
|
321
|
+
});
|
|
322
|
+
graph.canvas.appendChild(this.comboGroup);
|
|
323
|
+
graph.canvas.appendChild(this.edgeGroup);
|
|
324
|
+
graph.canvas.appendChild(this.nodeGroup);
|
|
325
|
+
graph.labelCanvas.appendChild(this.edgeLabelGroup);
|
|
326
|
+
graph.labelCanvas.appendChild(this.nodeLabelGroup);
|
|
237
327
|
|
|
238
328
|
// Also create transient groups on transient canvas.
|
|
239
329
|
transientCanvas.removeChildren();
|
|
@@ -252,6 +342,16 @@ export class ItemController {
|
|
|
252
342
|
transientCanvas.appendChild(this.transientComboGroup);
|
|
253
343
|
transientCanvas.appendChild(this.transientEdgeGroup);
|
|
254
344
|
transientCanvas.appendChild(this.transientNodeGroup);
|
|
345
|
+
this.transientEdgeLabelGroup = new Group({
|
|
346
|
+
id: 'node-label-group',
|
|
347
|
+
style: { zIndex: 0 },
|
|
348
|
+
});
|
|
349
|
+
this.transientNodeLabelGroup = new Group({
|
|
350
|
+
id: 'node-label-group',
|
|
351
|
+
style: { zIndex: 1 },
|
|
352
|
+
});
|
|
353
|
+
transientLabelCanvas.appendChild(this.transientEdgeLabelGroup);
|
|
354
|
+
transientLabelCanvas.appendChild(this.transientNodeLabelGroup);
|
|
255
355
|
|
|
256
356
|
// 1. create lights for webgl 3d rendering
|
|
257
357
|
if (graph.rendererType === 'webgl-3d') {
|
|
@@ -429,15 +529,21 @@ export class ItemController {
|
|
|
429
529
|
const { dataTypeField: nodeDataTypeField } = nodeTheme;
|
|
430
530
|
const edgeIdsToUpdate: Set<ID> = new Set<ID>();
|
|
431
531
|
const comboIdsToUpdate: Set<ID> = new Set<ID>();
|
|
432
|
-
const updateRelates = (edgeIds?: Set<ID
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
: [...comboIdsToUpdate, ...edgeIdsToUpdate];
|
|
436
|
-
ids.forEach((nid) => {
|
|
532
|
+
const updateRelates = (param: { edgeIds?: Set<ID>; callback?: any }) => {
|
|
533
|
+
const { edgeIds, callback } = param;
|
|
534
|
+
edgeIds.forEach((nid) => {
|
|
437
535
|
const item = itemMap.get(nid) as Edge | Combo;
|
|
438
536
|
if (item && !item.destroyed) item.forceUpdate();
|
|
439
537
|
});
|
|
538
|
+
callback?.();
|
|
440
539
|
};
|
|
540
|
+
const updateAllRelates = () => {
|
|
541
|
+
[...comboIdsToUpdate, ...edgeIdsToUpdate].forEach((nid) => {
|
|
542
|
+
const item = itemMap.get(nid) as Edge | Combo;
|
|
543
|
+
if (item && !item.destroyed) item.forceUpdate();
|
|
544
|
+
});
|
|
545
|
+
};
|
|
546
|
+
const debounceUpdateAllRelates = debounce(updateAllRelates, 16, false);
|
|
441
547
|
const debounceUpdateRelates = debounce(updateRelates, 16, false);
|
|
442
548
|
|
|
443
549
|
Object.values(nodeComboUpdate).forEach((updateObj: any) => {
|
|
@@ -466,7 +572,8 @@ export class ItemController {
|
|
|
466
572
|
this.expandCombo(graphCore, innerModel as ComboModel);
|
|
467
573
|
}
|
|
468
574
|
}
|
|
469
|
-
const previousParentId =
|
|
575
|
+
const previousParentId =
|
|
576
|
+
item.displayModel.data.parentId || previous.parentId;
|
|
470
577
|
// update the current parent combo tree
|
|
471
578
|
// if the node has previous parent, related previous parent combo should be updated to
|
|
472
579
|
if (upsertAncestors) {
|
|
@@ -521,20 +628,24 @@ export class ItemController {
|
|
|
521
628
|
);
|
|
522
629
|
}
|
|
523
630
|
|
|
524
|
-
const
|
|
525
|
-
innerModel?.data?.preventPolylineEdgeOverlap || false;
|
|
526
|
-
const relatedEdgeInnerModels = preventPolylineEdgeOverlap
|
|
527
|
-
? this.findNearEdgesByNode(id, graphCore).concat(
|
|
528
|
-
graphCore.getRelatedEdges(id),
|
|
529
|
-
)
|
|
530
|
-
: graphCore.getRelatedEdges(id);
|
|
631
|
+
const adjacentEdgeInnerModels = graphCore.getRelatedEdges(id);
|
|
531
632
|
|
|
532
|
-
|
|
633
|
+
if (isPointPreventPolylineOverlap(innerModel)) {
|
|
634
|
+
const newNearEdges = this.graph.getNearEdgesData(id, (edge) =>
|
|
635
|
+
isPolylineWithObstacleAvoidance(edge),
|
|
636
|
+
);
|
|
637
|
+
const prevNearEdges = this.nearEdgesCache.get(id) || [];
|
|
638
|
+
adjacentEdgeInnerModels.push(...newNearEdges);
|
|
639
|
+
adjacentEdgeInnerModels.push(...prevNearEdges);
|
|
640
|
+
this.nearEdgesCache.set(id, newNearEdges);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
adjacentEdgeInnerModels.forEach((edge) => {
|
|
533
644
|
edgeIdsToUpdate.add(edge.id);
|
|
534
645
|
nodeRelatedIdsToUpdate.add(edge.id);
|
|
535
646
|
});
|
|
536
647
|
|
|
537
|
-
item.onframe = () => updateRelates(nodeRelatedIdsToUpdate);
|
|
648
|
+
item.onframe = () => updateRelates({ edgeIds: nodeRelatedIdsToUpdate });
|
|
538
649
|
let statesCache;
|
|
539
650
|
if (
|
|
540
651
|
innerModel.data._isCombo &&
|
|
@@ -551,33 +662,29 @@ export class ItemController {
|
|
|
551
662
|
onlyMove,
|
|
552
663
|
animate,
|
|
553
664
|
// call after updating finished
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
leading: true,
|
|
568
|
-
trailing: true,
|
|
569
|
-
},
|
|
570
|
-
),
|
|
665
|
+
(_, canceled) => {
|
|
666
|
+
item.onframe = undefined;
|
|
667
|
+
if (statesCache) {
|
|
668
|
+
statesCache.forEach((state) =>
|
|
669
|
+
this.graph.setItemState(id, state, true),
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
// @ts-ignore
|
|
673
|
+
debounceUpdateRelates({
|
|
674
|
+
edgeIds: nodeRelatedIdsToUpdate,
|
|
675
|
+
callback: () => callback(innerModel, canceled),
|
|
676
|
+
});
|
|
677
|
+
},
|
|
571
678
|
);
|
|
572
679
|
|
|
573
680
|
const parentItem = this.itemMap.get(current.parentId);
|
|
574
681
|
if (current.parentId && parentItem?.model.data.collapsed) {
|
|
575
682
|
this.graph.executeWithNoStack(() => {
|
|
576
|
-
this.graph.hideItem(innerModel.id, false);
|
|
683
|
+
this.graph.hideItem(innerModel.id, { disableAnimate: false });
|
|
577
684
|
});
|
|
578
685
|
}
|
|
579
686
|
});
|
|
580
|
-
|
|
687
|
+
debounceUpdateAllRelates();
|
|
581
688
|
}
|
|
582
689
|
// === 6. update edges' data ===
|
|
583
690
|
if (groupedChanges.EdgeDataUpdated.length) {
|
|
@@ -656,7 +763,7 @@ export class ItemController {
|
|
|
656
763
|
let parent = graphCore.getParent(nodeId, 'tree');
|
|
657
764
|
while (parent) {
|
|
658
765
|
if (parent.data.collapsed) {
|
|
659
|
-
this.graph.hideItem(nodeId, true);
|
|
766
|
+
this.graph.hideItem(nodeId, { disableAnimate: true });
|
|
660
767
|
break;
|
|
661
768
|
}
|
|
662
769
|
parent = graphCore.getParent(parent.id, 'tree');
|
|
@@ -683,7 +790,11 @@ export class ItemController {
|
|
|
683
790
|
ids.forEach((id) => {
|
|
684
791
|
const item = this.itemMap.get(id);
|
|
685
792
|
if (!item) {
|
|
686
|
-
|
|
793
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_STATE] =
|
|
794
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_STATE] || [];
|
|
795
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_STATE].push(id);
|
|
796
|
+
// @ts-ignore
|
|
797
|
+
this.debounceWarn(WARN_TYPE.FAIL_SET_STATE);
|
|
687
798
|
return;
|
|
688
799
|
}
|
|
689
800
|
if (!states || !value) {
|
|
@@ -695,32 +806,77 @@ export class ItemController {
|
|
|
695
806
|
});
|
|
696
807
|
}
|
|
697
808
|
|
|
809
|
+
private onItemStateConfigChange(param: {
|
|
810
|
+
itemType: ITEM_TYPE;
|
|
811
|
+
stateConfig:
|
|
812
|
+
| {
|
|
813
|
+
[stateName: string]:
|
|
814
|
+
| ((data: NodeModel) => NodeDisplayModel)
|
|
815
|
+
| NodeShapesEncode;
|
|
816
|
+
}
|
|
817
|
+
| {
|
|
818
|
+
[stateName: string]:
|
|
819
|
+
| ((data: EdgeModel) => EdgeDisplayModel)
|
|
820
|
+
| EdgeShapesEncode;
|
|
821
|
+
}
|
|
822
|
+
| {
|
|
823
|
+
[stateName: string]:
|
|
824
|
+
| ((data: ComboModel) => ComboDisplayModel)
|
|
825
|
+
| ComboShapesEncode;
|
|
826
|
+
};
|
|
827
|
+
}) {
|
|
828
|
+
const { itemType, stateConfig } = param;
|
|
829
|
+
const fieldName = `${itemType}StateMapper`;
|
|
830
|
+
this[fieldName] = stateConfig;
|
|
831
|
+
this.graph.getAllNodesData().forEach((node) => {
|
|
832
|
+
const item = this.itemMap.get(node.id);
|
|
833
|
+
if (item) {
|
|
834
|
+
item.stateMapper = stateConfig;
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
|
|
698
839
|
private onItemVisibilityChange(param: {
|
|
699
840
|
ids: ID[];
|
|
841
|
+
shapeIds: string[];
|
|
700
842
|
value: boolean;
|
|
701
843
|
graphCore: GraphCore;
|
|
702
844
|
animate?: boolean;
|
|
703
845
|
keepKeyShape?: boolean;
|
|
846
|
+
keepRelated?: boolean;
|
|
704
847
|
}) {
|
|
705
848
|
const {
|
|
706
849
|
ids,
|
|
850
|
+
shapeIds,
|
|
707
851
|
value,
|
|
708
852
|
graphCore,
|
|
709
853
|
animate = true,
|
|
710
854
|
keepKeyShape = false,
|
|
855
|
+
keepRelated = false,
|
|
711
856
|
} = param;
|
|
712
857
|
ids.forEach((id) => {
|
|
713
858
|
const item = this.itemMap.get(id);
|
|
714
859
|
if (!item) {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
);
|
|
860
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_VISIBLE] =
|
|
861
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_VISIBLE] || [];
|
|
862
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_SET_VISIBLE].push(id);
|
|
863
|
+
// @ts-ignore
|
|
864
|
+
this.debounceWarn(WARN_TYPE.FAIL_SET_VISIBLE);
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
if (shapeIds?.length) {
|
|
868
|
+
if (value) {
|
|
869
|
+
item.show(animate, shapeIds);
|
|
870
|
+
} else {
|
|
871
|
+
item.hide(animate, false, shapeIds);
|
|
872
|
+
}
|
|
718
873
|
return;
|
|
719
874
|
}
|
|
720
875
|
const type = item.getType();
|
|
721
876
|
if (value) {
|
|
722
877
|
if (type === 'edge') {
|
|
723
878
|
item.show(animate);
|
|
879
|
+
(item as Edge).forceUpdate();
|
|
724
880
|
} else {
|
|
725
881
|
if (graphCore.hasTreeStructure('combo')) {
|
|
726
882
|
let anccestorCollapsed = false;
|
|
@@ -739,7 +895,7 @@ export class ItemController {
|
|
|
739
895
|
}
|
|
740
896
|
} else {
|
|
741
897
|
item.hide(animate, keepKeyShape);
|
|
742
|
-
if (type !== 'edge') {
|
|
898
|
+
if (type !== 'edge' && !keepRelated) {
|
|
743
899
|
const relatedEdges = graphCore.getRelatedEdges(id);
|
|
744
900
|
relatedEdges.forEach(({ id: edgeId }) => {
|
|
745
901
|
this.itemMap.get(edgeId)?.hide(animate);
|
|
@@ -784,6 +940,59 @@ export class ItemController {
|
|
|
784
940
|
});
|
|
785
941
|
}
|
|
786
942
|
|
|
943
|
+
/**
|
|
944
|
+
* get the items inside viewport
|
|
945
|
+
* @returns
|
|
946
|
+
*/
|
|
947
|
+
private groupItemsByView = (
|
|
948
|
+
containType: 'inside' | 'intersect' = 'inside',
|
|
949
|
+
ratio: number = 1,
|
|
950
|
+
) => {
|
|
951
|
+
const range = this.graph.getCanvasRange();
|
|
952
|
+
const items = Array.from(this.itemMap, ([key, value]) => value);
|
|
953
|
+
const containFunc =
|
|
954
|
+
containType === 'intersect' ? intersectBBox : isBBoxInBBox;
|
|
955
|
+
let { inView: itemsInView, outView: itemsOutView } =
|
|
956
|
+
this.cacheViewItems || {};
|
|
957
|
+
if (!ratio || ratio === 1 || !this.cacheViewItems) {
|
|
958
|
+
itemsInView = [];
|
|
959
|
+
itemsOutView = [];
|
|
960
|
+
items.forEach((item) => {
|
|
961
|
+
const { keyShape } = item.shapeMap;
|
|
962
|
+
if (!keyShape) return;
|
|
963
|
+
const renderBounds = keyShape.getRenderBounds();
|
|
964
|
+
if (containFunc(renderBounds, range, 0.4)) itemsInView.push(item);
|
|
965
|
+
else itemsOutView.push(item);
|
|
966
|
+
});
|
|
967
|
+
} else if (ratio < 1) {
|
|
968
|
+
// zoom-out
|
|
969
|
+
itemsOutView.forEach((item) => {
|
|
970
|
+
const { keyShape } = item.shapeMap;
|
|
971
|
+
if (!keyShape) return;
|
|
972
|
+
const renderBounds = keyShape.getRenderBounds();
|
|
973
|
+
if (containFunc(renderBounds, range, 0.4)) {
|
|
974
|
+
itemsInView.push(item);
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
} else if (ratio > 1) {
|
|
978
|
+
// zoom-in
|
|
979
|
+
itemsInView.forEach((item) => {
|
|
980
|
+
const { keyShape } = item.shapeMap;
|
|
981
|
+
if (!keyShape) return;
|
|
982
|
+
const renderBounds = keyShape.getRenderBounds();
|
|
983
|
+
if (!containFunc(renderBounds, range, 0.4)) {
|
|
984
|
+
itemsOutView.push(item);
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
this.cacheViewItems = { inView: itemsInView, outView: itemsOutView };
|
|
989
|
+
return {
|
|
990
|
+
items,
|
|
991
|
+
inView: itemsInView,
|
|
992
|
+
outView: itemsOutView,
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
|
|
787
996
|
private onViewportChange = debounce(
|
|
788
997
|
({
|
|
789
998
|
transform,
|
|
@@ -793,20 +1002,13 @@ export class ItemController {
|
|
|
793
1002
|
const { zoom } = transform;
|
|
794
1003
|
if (zoom) {
|
|
795
1004
|
const zoomRatio = this.graph.getZoom();
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
const renderBounds = keyShape.getRenderBounds();
|
|
804
|
-
if (isBBoxInBBox(renderBounds, range, 0.4))
|
|
805
|
-
itemsInViewport.push(item);
|
|
806
|
-
else itemsOutViewport.push(item);
|
|
807
|
-
});
|
|
808
|
-
const sortedItems = itemsInViewport.concat(itemsOutViewport);
|
|
809
|
-
const sections = Math.ceil(nodeItems.length / tileLodSize);
|
|
1005
|
+
const {
|
|
1006
|
+
items,
|
|
1007
|
+
inView: itemsInview,
|
|
1008
|
+
outView: itemsOutView,
|
|
1009
|
+
} = this.groupItemsByView();
|
|
1010
|
+
const sortedItems = itemsInview.concat(itemsOutView);
|
|
1011
|
+
const sections = Math.ceil(items.length / tileLodSize);
|
|
810
1012
|
const itemSections = Array.from({ length: sections }, (v, i) =>
|
|
811
1013
|
sortedItems.slice(i * tileLodSize, i * tileLodSize + tileLodSize),
|
|
812
1014
|
);
|
|
@@ -820,7 +1022,6 @@ export class ItemController {
|
|
|
820
1022
|
requestId = requestAnimationFrame(update);
|
|
821
1023
|
};
|
|
822
1024
|
requestId = requestAnimationFrame(update);
|
|
823
|
-
// this.itemMap.forEach((item) => item.updateZoom(zoomRatio));
|
|
824
1025
|
this.zoom = zoomRatio;
|
|
825
1026
|
}
|
|
826
1027
|
},
|
|
@@ -852,7 +1053,7 @@ export class ItemController {
|
|
|
852
1053
|
false,
|
|
853
1054
|
itemTheme as {
|
|
854
1055
|
styles: NodeStyleSet;
|
|
855
|
-
|
|
1056
|
+
lodLevels: LodLevelRanges;
|
|
856
1057
|
},
|
|
857
1058
|
);
|
|
858
1059
|
});
|
|
@@ -948,9 +1149,11 @@ export class ItemController {
|
|
|
948
1149
|
if (isItemType) {
|
|
949
1150
|
const item = this.itemMap.get(id);
|
|
950
1151
|
if (!item) {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
);
|
|
1152
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_DRAW_TRANSIENT] =
|
|
1153
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_DRAW_TRANSIENT] || [];
|
|
1154
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_DRAW_TRANSIENT].push(id);
|
|
1155
|
+
// @ts-ignore
|
|
1156
|
+
this.debounceWarn(WARN_TYPE.FAIL_DRAW_TRANSIENT);
|
|
954
1157
|
return;
|
|
955
1158
|
}
|
|
956
1159
|
const transientItem = upsertTransientItem(
|
|
@@ -958,13 +1161,14 @@ export class ItemController {
|
|
|
958
1161
|
this.transientNodeGroup,
|
|
959
1162
|
this.transientEdgeGroup,
|
|
960
1163
|
this.transientComboGroup,
|
|
1164
|
+
this.transientNodeLabelGroup,
|
|
1165
|
+
this.transientEdgeLabelGroup,
|
|
961
1166
|
this.transientItemMap,
|
|
962
1167
|
this.itemMap,
|
|
963
1168
|
graphCore,
|
|
964
1169
|
{ shapeIds, drawSource, drawTarget, visible },
|
|
965
1170
|
upsertAncestors,
|
|
966
1171
|
);
|
|
967
|
-
|
|
968
1172
|
if (shapeIds) {
|
|
969
1173
|
// only update node positions to cloned node container(group)
|
|
970
1174
|
if (
|
|
@@ -1033,17 +1237,23 @@ export class ItemController {
|
|
|
1033
1237
|
...data,
|
|
1034
1238
|
},
|
|
1035
1239
|
});
|
|
1240
|
+
if (type !== 'edge') {
|
|
1241
|
+
const relatedEdges = graphCore.getRelatedEdges(transItem.model.id);
|
|
1242
|
+
relatedEdges.forEach((relatedEdge) => {
|
|
1243
|
+
const transientEdge = this.transientItemMap.get(
|
|
1244
|
+
relatedEdge.id,
|
|
1245
|
+
) as Edge;
|
|
1246
|
+
if (transientEdge) transientEdge.forceUpdate();
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1036
1249
|
}
|
|
1037
1250
|
return;
|
|
1038
1251
|
}
|
|
1039
1252
|
|
|
1040
1253
|
const idStr = String(id);
|
|
1041
|
-
const shape = upsertShape(
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
style,
|
|
1045
|
-
Object.fromEntries(transientObjectMap),
|
|
1046
|
-
);
|
|
1254
|
+
const shape = upsertShape(type, idStr, style, {
|
|
1255
|
+
shapeMap: Object.fromEntries(transientObjectMap),
|
|
1256
|
+
});
|
|
1047
1257
|
transientObjectMap.set(idStr, shape);
|
|
1048
1258
|
shape.style.pointerEvents = capture ? 'auto' : 'none';
|
|
1049
1259
|
if (shape.parentNode === null) canvas.getRoot().appendChild(shape);
|
|
@@ -1053,16 +1263,31 @@ export class ItemController {
|
|
|
1053
1263
|
}
|
|
1054
1264
|
|
|
1055
1265
|
public getTransientItem(id: ID) {
|
|
1056
|
-
return this.transientItemMap
|
|
1266
|
+
return this.transientItemMap.get(id);
|
|
1057
1267
|
}
|
|
1058
1268
|
|
|
1059
|
-
public
|
|
1060
|
-
return this.itemMap
|
|
1269
|
+
public getItemMap() {
|
|
1270
|
+
return this.itemMap;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
public findDisplayModel(
|
|
1274
|
+
id: ID,
|
|
1275
|
+
): NodeDisplayModel | EdgeDisplayModel | ComboDisplayModel {
|
|
1276
|
+
const item = this.itemMap.get(id);
|
|
1277
|
+
if (!item) return { id, data: {} };
|
|
1278
|
+
return {
|
|
1279
|
+
id,
|
|
1280
|
+
data: {
|
|
1281
|
+
...item.displayModel.data,
|
|
1282
|
+
...item.renderExt.mergedStyles,
|
|
1283
|
+
lodLevels: item.lodLevels,
|
|
1284
|
+
},
|
|
1285
|
+
};
|
|
1061
1286
|
}
|
|
1062
1287
|
|
|
1063
1288
|
/**
|
|
1064
1289
|
* Create nodes with inner data to canvas.
|
|
1065
|
-
* @param models nodes' inner
|
|
1290
|
+
* @param models nodes' inner data
|
|
1066
1291
|
*/
|
|
1067
1292
|
private async renderNodes(
|
|
1068
1293
|
models: NodeModel[],
|
|
@@ -1072,7 +1297,13 @@ export class ItemController {
|
|
|
1072
1297
|
tileFirstRenderSize?: number;
|
|
1073
1298
|
},
|
|
1074
1299
|
): Promise<any> | undefined {
|
|
1075
|
-
const {
|
|
1300
|
+
const {
|
|
1301
|
+
nodeExtensions,
|
|
1302
|
+
nodeGroup,
|
|
1303
|
+
nodeLabelGroup,
|
|
1304
|
+
nodeDataTypeSet,
|
|
1305
|
+
graph,
|
|
1306
|
+
} = this;
|
|
1076
1307
|
const { dataTypeField = '' } = nodeTheme;
|
|
1077
1308
|
const { tileFirstRender, tileFirstRenderSize = 1000 } = tileOptimize || {};
|
|
1078
1309
|
const zoom = graph.getZoom();
|
|
@@ -1094,16 +1325,18 @@ export class ItemController {
|
|
|
1094
1325
|
);
|
|
1095
1326
|
|
|
1096
1327
|
const nodeItem = new Node({
|
|
1328
|
+
graph,
|
|
1097
1329
|
delayFirstDraw,
|
|
1098
1330
|
model: node,
|
|
1099
1331
|
renderExtensions: nodeExtensions,
|
|
1100
1332
|
containerGroup: nodeGroup,
|
|
1333
|
+
labelContainerGroup: nodeLabelGroup,
|
|
1101
1334
|
mapper: this.nodeMapper,
|
|
1102
1335
|
stateMapper: this.nodeStateMapper,
|
|
1103
1336
|
zoom,
|
|
1104
1337
|
theme: itemTheme as {
|
|
1105
1338
|
styles: NodeStyleSet;
|
|
1106
|
-
|
|
1339
|
+
lodLevels: LodLevelRanges;
|
|
1107
1340
|
},
|
|
1108
1341
|
device:
|
|
1109
1342
|
graph.rendererType === 'webgl-3d'
|
|
@@ -1195,10 +1428,12 @@ export class ItemController {
|
|
|
1195
1428
|
};
|
|
1196
1429
|
const comboItem = new Combo({
|
|
1197
1430
|
model: combo,
|
|
1431
|
+
graph: this.graph,
|
|
1198
1432
|
getCombinedBounds,
|
|
1199
1433
|
getChildren,
|
|
1200
1434
|
renderExtensions: comboExtensions,
|
|
1201
1435
|
containerGroup: comboGroup,
|
|
1436
|
+
labelContainerGroup: this.nodeLabelGroup,
|
|
1202
1437
|
mapper: this.comboMapper as DisplayMapper,
|
|
1203
1438
|
stateMapper: this.comboStateMapper as {
|
|
1204
1439
|
[stateName: string]: DisplayMapper;
|
|
@@ -1206,7 +1441,7 @@ export class ItemController {
|
|
|
1206
1441
|
zoom,
|
|
1207
1442
|
theme: itemTheme as {
|
|
1208
1443
|
styles: ComboStyleSet;
|
|
1209
|
-
|
|
1444
|
+
lodLevels: LodLevelRanges;
|
|
1210
1445
|
},
|
|
1211
1446
|
device:
|
|
1212
1447
|
graph.rendererType === 'webgl-3d'
|
|
@@ -1225,7 +1460,7 @@ export class ItemController {
|
|
|
1225
1460
|
|
|
1226
1461
|
/**
|
|
1227
1462
|
* Create edges with inner data to canvas.
|
|
1228
|
-
* @param models edges' inner
|
|
1463
|
+
* @param models edges' inner data
|
|
1229
1464
|
*/
|
|
1230
1465
|
private renderEdges(
|
|
1231
1466
|
models: EdgeModel[],
|
|
@@ -1236,7 +1471,14 @@ export class ItemController {
|
|
|
1236
1471
|
},
|
|
1237
1472
|
nodesInView?: Node[],
|
|
1238
1473
|
): Promise<any> | undefined {
|
|
1239
|
-
const {
|
|
1474
|
+
const {
|
|
1475
|
+
edgeExtensions,
|
|
1476
|
+
edgeGroup,
|
|
1477
|
+
edgeLabelGroup,
|
|
1478
|
+
itemMap,
|
|
1479
|
+
edgeDataTypeSet,
|
|
1480
|
+
graph,
|
|
1481
|
+
} = this;
|
|
1240
1482
|
const { dataTypeField = '' } = edgeTheme;
|
|
1241
1483
|
const { tileFirstRender, tileFirstRenderSize = 1000 } = tileOptimize || {};
|
|
1242
1484
|
const zoom = graph.getZoom();
|
|
@@ -1252,15 +1494,19 @@ export class ItemController {
|
|
|
1252
1494
|
const sourceItem = itemMap.get(source) as Node;
|
|
1253
1495
|
const targetItem = itemMap.get(target) as Node;
|
|
1254
1496
|
if (!sourceItem) {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
);
|
|
1497
|
+
this.cacheWarnMsg[WARN_TYPE.SOURCE_NOT_EXIST] =
|
|
1498
|
+
this.cacheWarnMsg[WARN_TYPE.SOURCE_NOT_EXIST] || [];
|
|
1499
|
+
this.cacheWarnMsg[WARN_TYPE.SOURCE_NOT_EXIST].push({ id, source });
|
|
1500
|
+
// @ts-ignore
|
|
1501
|
+
this.debounceWarn(WARN_TYPE.SOURCE_NOT_EXIST);
|
|
1258
1502
|
return;
|
|
1259
1503
|
}
|
|
1260
1504
|
if (!targetItem) {
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
);
|
|
1505
|
+
this.cacheWarnMsg[WARN_TYPE.TARGET_NOT_EXIST] =
|
|
1506
|
+
this.cacheWarnMsg[WARN_TYPE.TARGET_NOT_EXIST] || [];
|
|
1507
|
+
this.cacheWarnMsg[WARN_TYPE.TARGET_NOT_EXIST].push({ id, source });
|
|
1508
|
+
// @ts-ignore
|
|
1509
|
+
this.debounceWarn(WARN_TYPE.TARGET_NOT_EXIST);
|
|
1264
1510
|
return;
|
|
1265
1511
|
}
|
|
1266
1512
|
// get the base styles from theme
|
|
@@ -1272,12 +1518,13 @@ export class ItemController {
|
|
|
1272
1518
|
dataType,
|
|
1273
1519
|
edgeTheme,
|
|
1274
1520
|
);
|
|
1275
|
-
|
|
1276
1521
|
const edgeItem = new Edge({
|
|
1522
|
+
graph,
|
|
1277
1523
|
delayFirstDraw,
|
|
1278
1524
|
model: edge,
|
|
1279
1525
|
renderExtensions: edgeExtensions,
|
|
1280
1526
|
containerGroup: edgeGroup,
|
|
1527
|
+
labelContainerGroup: edgeLabelGroup,
|
|
1281
1528
|
mapper: this.edgeMapper as DisplayMapper,
|
|
1282
1529
|
stateMapper: this.edgeStateMapper as {
|
|
1283
1530
|
[stateName: string]: DisplayMapper;
|
|
@@ -1288,7 +1535,7 @@ export class ItemController {
|
|
|
1288
1535
|
zoom,
|
|
1289
1536
|
theme: itemTheme as {
|
|
1290
1537
|
styles: EdgeStyleSet;
|
|
1291
|
-
|
|
1538
|
+
lodLevels: LodLevelRanges;
|
|
1292
1539
|
},
|
|
1293
1540
|
});
|
|
1294
1541
|
|
|
@@ -1352,9 +1599,11 @@ export class ItemController {
|
|
|
1352
1599
|
public getItemState(id: ID, state: string) {
|
|
1353
1600
|
const item = this.itemMap.get(id);
|
|
1354
1601
|
if (!item) {
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
);
|
|
1602
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] =
|
|
1603
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] || [];
|
|
1604
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE].push(id);
|
|
1605
|
+
// @ts-ignore
|
|
1606
|
+
this.debounceWarn(WARN_TYPE.FAIL_GET_STATE);
|
|
1358
1607
|
return false;
|
|
1359
1608
|
}
|
|
1360
1609
|
return item.hasState(state);
|
|
@@ -1363,9 +1612,11 @@ export class ItemController {
|
|
|
1363
1612
|
public getItemAllStates(id: ID): string[] {
|
|
1364
1613
|
const item = this.itemMap.get(id);
|
|
1365
1614
|
if (!item) {
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
);
|
|
1615
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] =
|
|
1616
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] || [];
|
|
1617
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE].push(id);
|
|
1618
|
+
// @ts-ignore
|
|
1619
|
+
this.debounceWarn(WARN_TYPE.FAIL_GET_STATE);
|
|
1369
1620
|
return [];
|
|
1370
1621
|
}
|
|
1371
1622
|
return item
|
|
@@ -1387,74 +1638,50 @@ export class ItemController {
|
|
|
1387
1638
|
? this.transientItemMap.get(id)
|
|
1388
1639
|
: this.itemMap.get(id);
|
|
1389
1640
|
if (!item) {
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
);
|
|
1641
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_BBOX] =
|
|
1642
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_BBOX] || [];
|
|
1643
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_BBOX].push(id);
|
|
1644
|
+
// @ts-ignore
|
|
1645
|
+
this.debounceWarn(WARN_TYPE.FAIL_GET_BBOX);
|
|
1393
1646
|
return false;
|
|
1394
1647
|
}
|
|
1395
1648
|
if (item instanceof Group) return item.getRenderBounds();
|
|
1396
1649
|
return isKeyShape ? item.getKeyBBox() : item.getBBox();
|
|
1397
1650
|
}
|
|
1398
1651
|
|
|
1399
|
-
public
|
|
1652
|
+
public getItemVisibleShapeIds(id: ID) {
|
|
1400
1653
|
const item = this.itemMap.get(id);
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
return false;
|
|
1406
|
-
}
|
|
1407
|
-
return item.isVisible();
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
/**
|
|
1411
|
-
* Identify edges that are intersected by a particular node
|
|
1412
|
-
* @param nodeId node id
|
|
1413
|
-
* @param graphCore
|
|
1414
|
-
* @returns
|
|
1415
|
-
*/
|
|
1416
|
-
public findNearEdgesByNode(nodeId: ID, graphCore: GraphCore) {
|
|
1417
|
-
const edges = graphCore.getAllEdges();
|
|
1418
|
-
|
|
1419
|
-
const canvasBBox = this.graph.getRenderBBox(undefined) as AABB;
|
|
1420
|
-
const quadTree = new QuadTree(canvasBBox, 4);
|
|
1421
|
-
|
|
1422
|
-
each(edges, (edge) => {
|
|
1423
|
-
const {
|
|
1424
|
-
data: { x: sourceX, y: sourceY },
|
|
1425
|
-
} = graphCore.getNode(edge.source);
|
|
1426
|
-
const {
|
|
1427
|
-
data: { x: targetX, y: targetY },
|
|
1428
|
-
} = graphCore.getNode(edge.target);
|
|
1429
|
-
|
|
1430
|
-
quadTree.insert({
|
|
1431
|
-
id: edge.id,
|
|
1432
|
-
p1: { x: sourceX, y: sourceY },
|
|
1433
|
-
p2: { x: targetX, y: targetY },
|
|
1434
|
-
bbox: this.graph.getRenderBBox(edge.id) as AABB,
|
|
1435
|
-
});
|
|
1654
|
+
const shapeIds = [];
|
|
1655
|
+
Object.keys(item.shapeMap).forEach((shapeId) => {
|
|
1656
|
+
if (item.shapeMap[shapeId]?.attributes.visibility !== 'hidden')
|
|
1657
|
+
shapeIds.push(shapeId);
|
|
1436
1658
|
});
|
|
1659
|
+
return shapeIds;
|
|
1660
|
+
}
|
|
1437
1661
|
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
this.
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
);
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
const checker = new EdgeCollisionChecker(quadTree);
|
|
1451
|
-
const collisions = checker.getCollidingEdges(nodeBBox);
|
|
1662
|
+
private debounceWarn = debounce(
|
|
1663
|
+
(type) => {
|
|
1664
|
+
const msg = getWarnMsg[type](this.cacheWarnMsg[type]);
|
|
1665
|
+
console.warn(msg);
|
|
1666
|
+
this.cacheWarnMsg[type] = [];
|
|
1667
|
+
},
|
|
1668
|
+
16,
|
|
1669
|
+
false,
|
|
1670
|
+
);
|
|
1452
1671
|
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
)
|
|
1672
|
+
public getItemVisible(id: ID) {
|
|
1673
|
+
const item = this.itemMap.get(id);
|
|
1674
|
+
if (!item) {
|
|
1675
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_VISIBLE] =
|
|
1676
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_VISIBLE] || [];
|
|
1677
|
+
this.cacheWarnMsg[WARN_TYPE.FAIL_GET_VISIBLE].push(id);
|
|
1678
|
+
// @ts-ignore
|
|
1679
|
+
this.debounceWarn(WARN_TYPE.FAIL_GET_VISIBLE);
|
|
1456
1680
|
|
|
1457
|
-
|
|
1681
|
+
return false;
|
|
1682
|
+
}
|
|
1683
|
+
const transientVisible = this.transientItemMap.get(id);
|
|
1684
|
+
return item.isVisible() || transientVisible?.isVisible();
|
|
1458
1685
|
}
|
|
1459
1686
|
|
|
1460
1687
|
public sortByComboTree(graphCore: GraphCore) {
|
|
@@ -1474,7 +1701,7 @@ export class ItemController {
|
|
|
1474
1701
|
graphComboTreeDfs(this.graph, [comboModel], (child) => {
|
|
1475
1702
|
if (child.id !== comboModel.id) {
|
|
1476
1703
|
this.graph.executeWithNoStack(() => {
|
|
1477
|
-
this.graph.hideItem(child.id, false);
|
|
1704
|
+
this.graph.hideItem(child.id, { disableAnimate: false });
|
|
1478
1705
|
});
|
|
1479
1706
|
}
|
|
1480
1707
|
relatedEdges = relatedEdges.concat(graphCore.getRelatedEdges(child.id));
|
|
@@ -1658,9 +1885,10 @@ export class ItemController {
|
|
|
1658
1885
|
undefined,
|
|
1659
1886
|
!animate,
|
|
1660
1887
|
(model, canceled) => {
|
|
1661
|
-
|
|
1888
|
+
positions.forEach((position) => {
|
|
1889
|
+
this.graph.hideItem(position.id, { disableAnimate: canceled });
|
|
1890
|
+
});
|
|
1662
1891
|
},
|
|
1663
|
-
undefined,
|
|
1664
1892
|
);
|
|
1665
1893
|
}
|
|
1666
1894
|
|
|
@@ -1707,7 +1935,7 @@ export class ItemController {
|
|
|
1707
1935
|
allNodeIds = allNodeIds.concat(nodeIds.filter((id) => id !== root.id));
|
|
1708
1936
|
});
|
|
1709
1937
|
const ids = uniq(allNodeIds.concat(allEdgeIds));
|
|
1710
|
-
this.graph.showItem(ids, !animate);
|
|
1938
|
+
this.graph.showItem(ids, { disableAnimate: !animate });
|
|
1711
1939
|
await this.graph.layout(undefined, !animate);
|
|
1712
1940
|
}
|
|
1713
1941
|
}
|
|
@@ -1722,16 +1950,16 @@ const getItemTheme = (
|
|
|
1722
1950
|
| ComboThemeSpecifications,
|
|
1723
1951
|
): {
|
|
1724
1952
|
styles: NodeStyleSet | EdgeStyleSet;
|
|
1725
|
-
|
|
1953
|
+
lodLevels?: LodLevelRanges;
|
|
1726
1954
|
} => {
|
|
1727
|
-
const { styles: themeStyles = [],
|
|
1728
|
-
const
|
|
1955
|
+
const { styles: themeStyles = [], lodLevels } = itemTheme;
|
|
1956
|
+
const formattedLodLevels = formatLodLevels(lodLevels);
|
|
1729
1957
|
if (!dataTypeField) {
|
|
1730
1958
|
// dataType field is not assigned
|
|
1731
1959
|
const styles = isArray(themeStyles)
|
|
1732
1960
|
? themeStyles[0]
|
|
1733
1961
|
: Object.values(themeStyles)[0];
|
|
1734
|
-
return { styles,
|
|
1962
|
+
return { styles, lodLevels: formattedLodLevels };
|
|
1735
1963
|
}
|
|
1736
1964
|
dataTypeSet.add(dataType as string);
|
|
1737
1965
|
let themeStyle;
|
|
@@ -1746,7 +1974,7 @@ const getItemTheme = (
|
|
|
1746
1974
|
}
|
|
1747
1975
|
return {
|
|
1748
1976
|
styles: themeStyle,
|
|
1749
|
-
|
|
1977
|
+
lodLevels: formattedLodLevels,
|
|
1750
1978
|
};
|
|
1751
1979
|
};
|
|
1752
1980
|
|