@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
package/src/item/item.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Group, DisplayObject, AABB, IAnimation } from '@antv/g';
|
|
2
|
-
import {
|
|
2
|
+
import { isFunction, isObject, throttle } from '@antv/util';
|
|
3
3
|
import { OTHER_SHAPES_FIELD_NAME, RESERVED_SHAPE_IDS } from '../constant';
|
|
4
4
|
import { EdgeShapeMap } from '../types/edge';
|
|
5
5
|
import {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
ItemShapeStyles,
|
|
12
12
|
ITEM_TYPE,
|
|
13
13
|
State,
|
|
14
|
-
|
|
14
|
+
LodLevelRanges,
|
|
15
15
|
} from '../types/item';
|
|
16
16
|
import { NodeShapeMap } from '../types/node';
|
|
17
17
|
import { EdgeStyleSet, NodeStyleSet } from '../types/theme';
|
|
@@ -24,17 +24,19 @@ import {
|
|
|
24
24
|
} from '../util/shape';
|
|
25
25
|
import { isEncode } from '../util/type';
|
|
26
26
|
import { DEFAULT_MAPPER } from '../util/mapper';
|
|
27
|
+
import { cloneJSON } from '../util/data';
|
|
27
28
|
import {
|
|
28
29
|
getShapeAnimateBeginStyles,
|
|
29
30
|
animateShapes,
|
|
30
31
|
GROUP_ANIMATE_STYLES,
|
|
31
32
|
stopAnimate,
|
|
32
33
|
} from '../util/animate';
|
|
33
|
-
import { AnimateTiming, IAnimates } from '../types/animate';
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
34
|
+
import { AnimateTiming, IAnimates, IStateAnimate } from '../types/animate';
|
|
35
|
+
import { formatLodLevels } from '../util/zoom';
|
|
36
|
+
import { IGraph } from '../types';
|
|
36
37
|
|
|
37
38
|
export default abstract class Item implements IItem {
|
|
39
|
+
public graph: IGraph;
|
|
38
40
|
public destroyed = false;
|
|
39
41
|
/** Inner model. */
|
|
40
42
|
public model: ItemModel;
|
|
@@ -42,12 +44,14 @@ export default abstract class Item implements IItem {
|
|
|
42
44
|
public displayModel: ItemDisplayModel;
|
|
43
45
|
/** The mapper configured at graph with field name 'node' / 'edge' / 'combo'. */
|
|
44
46
|
public mapper: DisplayMapper;
|
|
45
|
-
/** The state
|
|
47
|
+
/** The state style mapper configured at graph with field name 'nodeState' / 'edgeState' / 'comboState'. */
|
|
46
48
|
public stateMapper: {
|
|
47
49
|
[stateName: string]: DisplayMapper;
|
|
48
50
|
};
|
|
49
51
|
/** The graphic group for item drawing. */
|
|
50
52
|
public group: Group;
|
|
53
|
+
/** The graphic group for item'label drawing. */
|
|
54
|
+
public labelGroup: Group;
|
|
51
55
|
/** The keyShape of the item. */
|
|
52
56
|
public keyShape: DisplayObject;
|
|
53
57
|
/** render extension for this item. */
|
|
@@ -63,7 +67,9 @@ export default abstract class Item implements IItem {
|
|
|
63
67
|
public shapeMap: NodeShapeMap | EdgeShapeMap = {
|
|
64
68
|
keyShape: undefined,
|
|
65
69
|
};
|
|
66
|
-
public afterDrawShapeMap
|
|
70
|
+
public afterDrawShapeMap: {
|
|
71
|
+
[otherShapeId: string]: DisplayObject;
|
|
72
|
+
} = {};
|
|
67
73
|
/** Set to different value in implements. */
|
|
68
74
|
public type: ITEM_TYPE;
|
|
69
75
|
/** The flag of transient item. */
|
|
@@ -79,10 +85,10 @@ export default abstract class Item implements IItem {
|
|
|
79
85
|
[stateName: string]: ItemShapeStyles;
|
|
80
86
|
};
|
|
81
87
|
/** The zoom strategy to show and hide shapes according to their lod. */
|
|
82
|
-
public
|
|
88
|
+
public lodLevels: LodLevelRanges;
|
|
83
89
|
/** Last zoom ratio. */
|
|
84
90
|
public zoom: number;
|
|
85
|
-
/** Cache the
|
|
91
|
+
/** Cache the changing states which are not consumed by draw */
|
|
86
92
|
public changedStates: string[];
|
|
87
93
|
/** The listener for the animations frames. */
|
|
88
94
|
public onframe: Function;
|
|
@@ -103,8 +109,10 @@ export default abstract class Item implements IItem {
|
|
|
103
109
|
/** Initiate the item. */
|
|
104
110
|
public init(props) {
|
|
105
111
|
const {
|
|
112
|
+
graph,
|
|
106
113
|
model,
|
|
107
114
|
containerGroup,
|
|
115
|
+
labelContainerGroup,
|
|
108
116
|
mapper,
|
|
109
117
|
stateMapper,
|
|
110
118
|
renderExtensions,
|
|
@@ -113,10 +121,15 @@ export default abstract class Item implements IItem {
|
|
|
113
121
|
type: itemType,
|
|
114
122
|
} = props;
|
|
115
123
|
this.type = itemType;
|
|
124
|
+
this.graph = graph;
|
|
116
125
|
this.group = new Group({ style: { zIndex: 0 } });
|
|
126
|
+
this.labelGroup = new Group({ style: { zIndex: 0 } });
|
|
117
127
|
this.group.setAttribute('data-item-type', this.type);
|
|
118
128
|
this.group.setAttribute('data-item-id', props.model.id);
|
|
129
|
+
this.labelGroup.setAttribute('data-item-type', this.type);
|
|
130
|
+
this.labelGroup.setAttribute('data-item-id', props.model.id);
|
|
119
131
|
containerGroup.appendChild(this.group);
|
|
132
|
+
labelContainerGroup.appendChild(this.labelGroup);
|
|
120
133
|
this.model = model;
|
|
121
134
|
this.mapper = mapper;
|
|
122
135
|
this.zoom = zoom;
|
|
@@ -125,14 +138,14 @@ export default abstract class Item implements IItem {
|
|
|
125
138
|
this.renderExtensions = renderExtensions;
|
|
126
139
|
const {
|
|
127
140
|
type = this.type === 'edge' ? 'line-edge' : `circle-${this.type}`,
|
|
128
|
-
|
|
141
|
+
lodLevels: modelLodLevels,
|
|
129
142
|
enableBalanceShape,
|
|
130
143
|
} = this.displayModel.data;
|
|
131
144
|
const RenderExtension = renderExtensions.find((ext) => ext.type === type);
|
|
132
145
|
this.themeStyles = theme.styles;
|
|
133
|
-
|
|
134
|
-
?
|
|
135
|
-
: theme.
|
|
146
|
+
this.lodLevels = modelLodLevels
|
|
147
|
+
? formatLodLevels(modelLodLevels)
|
|
148
|
+
: theme.lodLevels;
|
|
136
149
|
if (!RenderExtension) {
|
|
137
150
|
if (this.type === 'node') {
|
|
138
151
|
throw new Error(
|
|
@@ -150,10 +163,11 @@ export default abstract class Item implements IItem {
|
|
|
150
163
|
}
|
|
151
164
|
this.renderExt = new RenderExtension({
|
|
152
165
|
themeStyles: this.themeStyles?.default,
|
|
153
|
-
|
|
166
|
+
lodLevels: this.lodLevels,
|
|
154
167
|
enableBalanceShape,
|
|
155
168
|
device: this.device,
|
|
156
169
|
zoom: this.zoom,
|
|
170
|
+
graph: this.graph,
|
|
157
171
|
});
|
|
158
172
|
}
|
|
159
173
|
|
|
@@ -170,14 +184,27 @@ export default abstract class Item implements IItem {
|
|
|
170
184
|
) {
|
|
171
185
|
// call this.renderExt.draw in extend implementations
|
|
172
186
|
const afterDrawShapeMap =
|
|
173
|
-
this.renderExt.afterDraw?.(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
187
|
+
this.renderExt.afterDraw?.(
|
|
188
|
+
displayModel,
|
|
189
|
+
{
|
|
190
|
+
...this.shapeMap,
|
|
191
|
+
...this.afterDrawShapeMap,
|
|
192
|
+
},
|
|
193
|
+
diffData,
|
|
194
|
+
diffState,
|
|
195
|
+
) || {};
|
|
196
|
+
if (this.afterDrawShapeMap.labelShape) {
|
|
197
|
+
this.afterDrawShapeMap.labelShape.attributes.dataIsLabel = true;
|
|
198
|
+
}
|
|
199
|
+
if (this.afterDrawShapeMap.labelBackgroundShape) {
|
|
200
|
+
this.afterDrawShapeMap.labelBackgroundShape.attributes.dataIsLabelBackground =
|
|
201
|
+
true;
|
|
202
|
+
}
|
|
177
203
|
const shapeMap = updateShapes(
|
|
178
204
|
this.afterDrawShapeMap,
|
|
179
205
|
afterDrawShapeMap,
|
|
180
206
|
this.group,
|
|
207
|
+
this.labelGroup,
|
|
181
208
|
false,
|
|
182
209
|
(id) => {
|
|
183
210
|
if (RESERVED_SHAPE_IDS.includes(id)) {
|
|
@@ -193,6 +220,7 @@ export default abstract class Item implements IItem {
|
|
|
193
220
|
...this.shapeMap,
|
|
194
221
|
...shapeMap,
|
|
195
222
|
};
|
|
223
|
+
this.changedStates = [];
|
|
196
224
|
}
|
|
197
225
|
|
|
198
226
|
/**
|
|
@@ -205,7 +233,7 @@ export default abstract class Item implements IItem {
|
|
|
205
233
|
isReplace?: boolean,
|
|
206
234
|
itemTheme?: {
|
|
207
235
|
styles: NodeStyleSet | EdgeStyleSet;
|
|
208
|
-
|
|
236
|
+
lodLevels: LodLevelRanges;
|
|
209
237
|
},
|
|
210
238
|
onlyMove?: boolean,
|
|
211
239
|
animate = true,
|
|
@@ -224,9 +252,9 @@ export default abstract class Item implements IItem {
|
|
|
224
252
|
);
|
|
225
253
|
this.displayModel = displayModel;
|
|
226
254
|
|
|
227
|
-
this.
|
|
228
|
-
?
|
|
229
|
-
: itemTheme?.
|
|
255
|
+
this.lodLevels = displayModel.data.lodLevels
|
|
256
|
+
? formatLodLevels(displayModel.data.lodLevels)
|
|
257
|
+
: itemTheme?.lodLevels || this.lodLevels;
|
|
230
258
|
|
|
231
259
|
if (onlyMove) {
|
|
232
260
|
this.updatePosition(displayModel, diffData, animate, onfinish);
|
|
@@ -243,13 +271,14 @@ export default abstract class Item implements IItem {
|
|
|
243
271
|
);
|
|
244
272
|
this.renderExt = new RenderExtension({
|
|
245
273
|
themeStyles: this.themeStyles.default,
|
|
246
|
-
|
|
274
|
+
lodLevels: this.lodLevels,
|
|
247
275
|
device: this.device,
|
|
248
276
|
zoom: this.zoom,
|
|
277
|
+
graph: this.graph,
|
|
249
278
|
});
|
|
250
279
|
} else {
|
|
251
280
|
this.renderExt.themeStyles = this.themeStyles.default;
|
|
252
|
-
this.renderExt.
|
|
281
|
+
this.renderExt.lodLevels = this.lodLevels;
|
|
253
282
|
}
|
|
254
283
|
// 3. call element update fn from useLib
|
|
255
284
|
if (this.states?.length) {
|
|
@@ -325,7 +354,7 @@ export default abstract class Item implements IItem {
|
|
|
325
354
|
// === fields' values in mapper are final value or Encode ===
|
|
326
355
|
const dataChangedFields = isReplace
|
|
327
356
|
? undefined
|
|
328
|
-
: Object.keys(current).concat(Object.keys(otherFields)); // only fields in current data for partial updating
|
|
357
|
+
: Object.keys(current || {}).concat(Object.keys(otherFields)); // only fields in current data for partial updating
|
|
329
358
|
|
|
330
359
|
let typeChange = false;
|
|
331
360
|
const { data, ...otherProps } = innerModel;
|
|
@@ -364,9 +393,12 @@ export default abstract class Item implements IItem {
|
|
|
364
393
|
if (isReservedShapeId) {
|
|
365
394
|
// reserved shapes, fieldName is shapeId
|
|
366
395
|
displayModelData[fieldName] =
|
|
367
|
-
displayModelData[fieldName] ||
|
|
396
|
+
displayModelData[fieldName] ||
|
|
397
|
+
isObject(innerModel.data[fieldName]) ||
|
|
398
|
+
isObject(this.displayModel?.data[fieldName])
|
|
368
399
|
? {
|
|
369
400
|
...(innerModel.data[fieldName] as object),
|
|
401
|
+
...(this.displayModel?.data[fieldName] as object),
|
|
370
402
|
}
|
|
371
403
|
: {};
|
|
372
404
|
updateShapeChange({
|
|
@@ -418,10 +450,23 @@ export default abstract class Item implements IItem {
|
|
|
418
450
|
}
|
|
419
451
|
|
|
420
452
|
/** Show the item. */
|
|
421
|
-
public show(animate = true) {
|
|
422
|
-
|
|
453
|
+
public show(animate = true, shapeIds = undefined) {
|
|
454
|
+
const shapeIdsToStop = shapeIds?.filter((id) => {
|
|
455
|
+
const shape = this.shapeMap[id];
|
|
456
|
+
return shape && shape.style.visibility === 'hidden';
|
|
457
|
+
});
|
|
458
|
+
if (shapeIds?.length && !shapeIdsToStop?.length) return;
|
|
459
|
+
if (!shapeIdsToStop || shapeIdsToStop.includes('labelShape')) {
|
|
460
|
+
this.labelGroup.style.visibility = 'visible';
|
|
461
|
+
}
|
|
462
|
+
Promise.all(this.stopAnimations(shapeIdsToStop)).finally(() => {
|
|
423
463
|
if (this.destroyed) return;
|
|
424
464
|
const { animates = {} } = this.displayModel.data;
|
|
465
|
+
const shapeIdsToShow =
|
|
466
|
+
shapeIdsToStop ||
|
|
467
|
+
Object.keys(this.shapeMap).filter(
|
|
468
|
+
(shapeId) => this.cacheHiddenByItem[shapeId],
|
|
469
|
+
);
|
|
425
470
|
if (animate && animates.show?.length) {
|
|
426
471
|
const showAnimateFieldsMap: any = {};
|
|
427
472
|
Object.values(animates.show).forEach((animate) => {
|
|
@@ -431,24 +476,26 @@ export default abstract class Item implements IItem {
|
|
|
431
476
|
).concat(animate.fields);
|
|
432
477
|
});
|
|
433
478
|
const targetStyleMap = {};
|
|
434
|
-
|
|
479
|
+
shapeIdsToShow.forEach((id) => {
|
|
435
480
|
const shape = this.shapeMap[id];
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
shape.show();
|
|
481
|
+
// set the animate fields to initial value
|
|
482
|
+
if (showAnimateFieldsMap[id]) {
|
|
483
|
+
targetStyleMap[id] = targetStyleMap[id] || {};
|
|
484
|
+
const beginStyle = getShapeAnimateBeginStyles(shape);
|
|
485
|
+
showAnimateFieldsMap[id].forEach((field) => {
|
|
486
|
+
if (beginStyle.hasOwnProperty(field)) {
|
|
487
|
+
targetStyleMap[id][field] = shape.style[field];
|
|
488
|
+
shape.style[field] = beginStyle[field];
|
|
489
|
+
}
|
|
490
|
+
});
|
|
449
491
|
}
|
|
492
|
+
shape.show();
|
|
493
|
+
delete this.cacheHiddenByItem[id];
|
|
450
494
|
});
|
|
451
|
-
if (
|
|
495
|
+
if (
|
|
496
|
+
showAnimateFieldsMap.group &&
|
|
497
|
+
this.shapeMap.keyShape.attributes.visibility === 'hidden'
|
|
498
|
+
) {
|
|
452
499
|
showAnimateFieldsMap.group.forEach((field) => {
|
|
453
500
|
const usingField = field === 'size' ? 'transform' : field;
|
|
454
501
|
if (GROUP_ANIMATE_STYLES[0].hasOwnProperty(usingField)) {
|
|
@@ -457,23 +504,24 @@ export default abstract class Item implements IItem {
|
|
|
457
504
|
}
|
|
458
505
|
});
|
|
459
506
|
}
|
|
460
|
-
|
|
461
507
|
if (Object.keys(targetStyleMap).length) {
|
|
462
508
|
this.animations = this.runWithAnimates(
|
|
463
509
|
animates,
|
|
464
510
|
'show',
|
|
465
511
|
targetStyleMap,
|
|
512
|
+
shapeIdsToShow,
|
|
466
513
|
);
|
|
467
514
|
}
|
|
468
515
|
} else {
|
|
469
|
-
|
|
516
|
+
shapeIdsToShow.forEach((id) => {
|
|
470
517
|
const shape = this.shapeMap[id];
|
|
471
|
-
|
|
518
|
+
shape.show();
|
|
519
|
+
delete this.cacheHiddenByItem[id];
|
|
472
520
|
});
|
|
473
521
|
}
|
|
474
522
|
|
|
475
523
|
this.visible = true;
|
|
476
|
-
this.cacheHiddenByItem = {};
|
|
524
|
+
if (!shapeIds) this.cacheHiddenByItem = {};
|
|
477
525
|
// restore the states
|
|
478
526
|
if (this.states?.length) {
|
|
479
527
|
this.drawWithStates([]);
|
|
@@ -482,21 +530,32 @@ export default abstract class Item implements IItem {
|
|
|
482
530
|
}
|
|
483
531
|
|
|
484
532
|
/** Hides the item. */
|
|
485
|
-
public hide(animate = true, keepKeyShape = false) {
|
|
533
|
+
public hide(animate = true, keepKeyShape = false, shapeIds = undefined) {
|
|
534
|
+
const shapeIdsToHide =
|
|
535
|
+
shapeIds?.filter((id) => {
|
|
536
|
+
const shape = this.shapeMap[id];
|
|
537
|
+
return (
|
|
538
|
+
shape &&
|
|
539
|
+
(shape.attributes.visibility !== 'hidden' ||
|
|
540
|
+
this.cacheNotHiddenByItem[id])
|
|
541
|
+
);
|
|
542
|
+
}) || Object.keys(this.shapeMap);
|
|
543
|
+
if (!shapeIdsToHide.length) return;
|
|
486
544
|
this.cacheNotHiddenByItem = {};
|
|
487
545
|
const func = () => {
|
|
488
|
-
|
|
546
|
+
shapeIdsToHide.forEach((id) => {
|
|
489
547
|
if (keepKeyShape && id === 'keyShape') return;
|
|
490
548
|
const shape = this.shapeMap[id];
|
|
491
|
-
if (!shape.
|
|
549
|
+
if (!shape || shape.attributes.visibility === 'hidden') {
|
|
492
550
|
this.cacheNotHiddenByItem[id] = true;
|
|
493
551
|
return;
|
|
494
552
|
}
|
|
495
553
|
shape.hide();
|
|
496
554
|
this.cacheHiddenByItem[id] = true;
|
|
555
|
+
if (!shapeIds) this.visible = false;
|
|
497
556
|
});
|
|
498
557
|
};
|
|
499
|
-
Promise.all(this.stopAnimations()).then(() => {
|
|
558
|
+
Promise.all(this.stopAnimations(shapeIdsToHide)).then(() => {
|
|
500
559
|
if (this.destroyed) return;
|
|
501
560
|
const { animates = {} } = this.displayModel.data;
|
|
502
561
|
if (animate && animates.hide?.length) {
|
|
@@ -504,13 +563,13 @@ export default abstract class Item implements IItem {
|
|
|
504
563
|
animates,
|
|
505
564
|
'hide',
|
|
506
565
|
undefined,
|
|
566
|
+
shapeIdsToHide,
|
|
507
567
|
func,
|
|
508
568
|
);
|
|
509
569
|
} else {
|
|
510
570
|
// 2. clear group and remove group
|
|
511
571
|
func();
|
|
512
572
|
}
|
|
513
|
-
this.visible = false;
|
|
514
573
|
});
|
|
515
574
|
}
|
|
516
575
|
|
|
@@ -545,7 +604,7 @@ export default abstract class Item implements IItem {
|
|
|
545
604
|
* @param value state value
|
|
546
605
|
*/
|
|
547
606
|
public setState(state: string, value: string | boolean) {
|
|
548
|
-
const previousStates =
|
|
607
|
+
const previousStates = cloneJSON(this.states);
|
|
549
608
|
const existState = this.states.find((item) => item.name === state);
|
|
550
609
|
if (value) {
|
|
551
610
|
if (existState) existState.value = value;
|
|
@@ -574,7 +633,7 @@ export default abstract class Item implements IItem {
|
|
|
574
633
|
*/
|
|
575
634
|
public clearStates(states?: string[]) {
|
|
576
635
|
// if states is not assigned, clear all the states on the item
|
|
577
|
-
const previousStates =
|
|
636
|
+
const previousStates = cloneJSON(this.states);
|
|
578
637
|
const newStates = [];
|
|
579
638
|
let changedStates = [];
|
|
580
639
|
if (states) {
|
|
@@ -623,11 +682,12 @@ export default abstract class Item implements IItem {
|
|
|
623
682
|
animates: IAnimates,
|
|
624
683
|
timing: AnimateTiming,
|
|
625
684
|
targetStyleMap: Object,
|
|
685
|
+
shapeIdsToShow: string[] | undefined,
|
|
626
686
|
callback: Function = () => {},
|
|
627
687
|
) {
|
|
628
688
|
let targetStyle = {};
|
|
629
689
|
if (!targetStyleMap) {
|
|
630
|
-
|
|
690
|
+
shapeIdsToShow?.forEach((shapeId) => {
|
|
631
691
|
targetStyle[shapeId] = getShapeAnimateBeginStyles(
|
|
632
692
|
this.shapeMap[shapeId],
|
|
633
693
|
);
|
|
@@ -639,7 +699,8 @@ export default abstract class Item implements IItem {
|
|
|
639
699
|
animates,
|
|
640
700
|
targetStyle, // targetStylesMap
|
|
641
701
|
this.shapeMap, // shapeMap
|
|
642
|
-
|
|
702
|
+
shapeIdsToShow,
|
|
703
|
+
[this.group, this.labelGroup],
|
|
643
704
|
timing,
|
|
644
705
|
[],
|
|
645
706
|
() => {},
|
|
@@ -715,7 +776,9 @@ export default abstract class Item implements IItem {
|
|
|
715
776
|
const mergedData = mergeStyles([displayModelData, styles]);
|
|
716
777
|
const { animates } = mergedData;
|
|
717
778
|
const displayUpdateAnimates = [];
|
|
718
|
-
const stateNames =
|
|
779
|
+
const stateNames = previousStates
|
|
780
|
+
.concat(this.states)
|
|
781
|
+
.map((state) => state.name);
|
|
719
782
|
animates?.update?.forEach((animateCfg) => {
|
|
720
783
|
const { states } = animateCfg as IStateAnimate;
|
|
721
784
|
if (states && isArrayOverlap(states, stateNames)) {
|
|
@@ -801,15 +864,18 @@ export default abstract class Item implements IItem {
|
|
|
801
864
|
/**
|
|
802
865
|
* Stop all the animations on the item.
|
|
803
866
|
*/
|
|
804
|
-
public stopAnimations() {
|
|
867
|
+
public stopAnimations(shapeIds?: string[]) {
|
|
805
868
|
const promises = [];
|
|
806
869
|
if (this.animations?.length) {
|
|
807
|
-
|
|
808
|
-
const animate = this.animations
|
|
809
|
-
if (animate.
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
870
|
+
for (let i = 0; i < this.animations.length; i++) {
|
|
871
|
+
const animate = this.animations[i];
|
|
872
|
+
if (!shapeIds?.length || shapeIds.includes(animate.effect.target.id)) {
|
|
873
|
+
this.animations.pop();
|
|
874
|
+
if (animate.playState !== 'running') break;
|
|
875
|
+
promises.push(stopAnimate(animate));
|
|
876
|
+
// @ts-ignore
|
|
877
|
+
animate.onManualCancel?.();
|
|
878
|
+
}
|
|
813
879
|
}
|
|
814
880
|
}
|
|
815
881
|
if (this.groupAnimations?.length) {
|
|
@@ -848,10 +914,16 @@ export default abstract class Item implements IItem {
|
|
|
848
914
|
this.renderExt.onZoom(this.shapeMap, zoom, this.cacheHiddenByItem);
|
|
849
915
|
}
|
|
850
916
|
|
|
917
|
+
/**
|
|
918
|
+
* Update label positions on label canvas by getting viewport position from transformed canvas position.
|
|
919
|
+
*/
|
|
920
|
+
public updateLabelPosition(ignoreVisibility: boolean = false) {}
|
|
921
|
+
|
|
851
922
|
/** Destroy the item. */
|
|
852
923
|
public destroy() {
|
|
853
924
|
const func = () => {
|
|
854
925
|
this.group.destroy();
|
|
926
|
+
this.labelGroup.destroy();
|
|
855
927
|
this.model = null;
|
|
856
928
|
this.displayModel = null;
|
|
857
929
|
this.destroyed = true;
|
|
@@ -864,6 +936,7 @@ export default abstract class Item implements IItem {
|
|
|
864
936
|
animates,
|
|
865
937
|
'buildOut',
|
|
866
938
|
undefined,
|
|
939
|
+
undefined,
|
|
867
940
|
func,
|
|
868
941
|
);
|
|
869
942
|
} else {
|
|
@@ -938,12 +1011,12 @@ const updateShapeChange = ({
|
|
|
938
1011
|
});
|
|
939
1012
|
Object.keys(mapper).forEach((shapeAttrName) => {
|
|
940
1013
|
if (innerModelValue?.hasOwnProperty(shapeAttrName)) return;
|
|
941
|
-
const { value: mappedValue } = updateChange({
|
|
1014
|
+
const { value: mappedValue, changed } = updateChange({
|
|
942
1015
|
innerModel,
|
|
943
1016
|
mapper,
|
|
944
1017
|
fieldName: shapeAttrName,
|
|
945
1018
|
dataChangedFields,
|
|
946
1019
|
});
|
|
947
|
-
shapeConfig[shapeAttrName] = mappedValue;
|
|
1020
|
+
if (changed) shapeConfig[shapeAttrName] = mappedValue;
|
|
948
1021
|
});
|
|
949
1022
|
};
|