@antv/g6 5.0.0-alpha.9 → 5.0.0-beta.1
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/dist/g6.min.js +2 -2
- package/esm/api-doc/behaviors.d.ts +2 -0
- package/esm/api-doc/behaviors.js +2 -0
- package/esm/api-doc/behaviors.js.map +1 -0
- package/esm/api-doc/graph.d.ts +4 -0
- package/esm/api-doc/graph.js +4 -0
- package/esm/api-doc/graph.js.map +1 -0
- package/esm/api-doc/item.d.ts +11 -0
- package/esm/api-doc/item.js +5 -0
- package/esm/api-doc/item.js.map +1 -0
- package/esm/api-doc/layout.d.ts +1 -0
- package/esm/api-doc/layout.js +2 -0
- package/esm/api-doc/layout.js.map +1 -0
- package/esm/api-doc/plugins.d.ts +1 -0
- package/esm/api-doc/plugins.js +2 -0
- package/esm/api-doc/plugins.js.map +1 -0
- package/esm/api-doc/types.d.ts +0 -0
- package/esm/api-doc/types.js +3 -0
- package/esm/api-doc/types.js.map +1 -0
- package/esm/api-doc/util.d.ts +3 -0
- package/esm/api-doc/util.js +4 -0
- package/esm/api-doc/util.js.map +1 -0
- package/esm/constant/shape.d.ts +7 -14
- package/esm/constant/shape.js +1 -0
- package/esm/constant/shape.js.map +1 -1
- package/esm/index.d.ts +213 -113
- package/esm/index.js +11 -4
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +13 -6
- package/esm/item/combo.js +72 -8
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +12 -9
- package/esm/item/edge.js +38 -11
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +8 -6
- package/esm/item/item.js +124 -81
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +14 -9
- package/esm/item/node.js +63 -48
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +17 -1
- package/esm/runtime/controller/data.js +321 -224
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/interaction.d.ts +1 -0
- package/esm/runtime/controller/interaction.js +7 -4
- package/esm/runtime/controller/interaction.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +37 -4
- package/esm/runtime/controller/item.js +475 -177
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.d.ts +4 -1
- package/esm/runtime/controller/layout.js +96 -14
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/controller/plugin.d.ts +11 -0
- package/esm/runtime/controller/plugin.js +39 -6
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/controller/theme.js +8 -4
- package/esm/runtime/controller/theme.js.map +1 -1
- package/esm/runtime/graph.d.ts +181 -39
- package/esm/runtime/graph.js +561 -72
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +2 -3
- package/esm/stdlib/behavior/activate-relations.js +13 -9
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.d.ts +3 -4
- package/esm/stdlib/behavior/brush-select.js +2 -2
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/click-select.d.ts +2 -3
- package/esm/stdlib/behavior/click-select.js +8 -6
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/collapse-expand-combo.d.ts +1 -2
- package/esm/stdlib/behavior/collapse-expand-combo.js +1 -1
- package/esm/stdlib/behavior/collapse-expand-combo.js.map +1 -1
- package/esm/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
- package/esm/stdlib/behavior/collapse-expand-tree.js +69 -0
- package/esm/stdlib/behavior/collapse-expand-tree.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +1 -2
- package/esm/stdlib/behavior/drag-canvas.js +22 -18
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +16 -4
- package/esm/stdlib/behavior/drag-combo.js +70 -31
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.d.ts +20 -4
- package/esm/stdlib/behavior/drag-node.js +145 -57
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/hover-activate.d.ts +1 -2
- package/esm/stdlib/behavior/hover-activate.js +1 -1
- package/esm/stdlib/behavior/hover-activate.js.map +1 -1
- package/esm/stdlib/behavior/index.d.ts +15 -0
- package/esm/stdlib/behavior/index.js +16 -0
- package/esm/stdlib/behavior/index.js.map +1 -0
- package/esm/stdlib/behavior/lasso-select.d.ts +7 -3
- package/esm/stdlib/behavior/lasso-select.js +2 -2
- package/esm/stdlib/behavior/lasso-select.js.map +1 -1
- package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
- package/esm/stdlib/behavior/orbit-canvas-3d.js +2 -2
- package/esm/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
- package/esm/stdlib/behavior/rotate-canvas-3d.js +1 -1
- package/esm/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/track-canvas-3d.d.ts +2 -3
- package/esm/stdlib/behavior/track-canvas-3d.js +2 -2
- package/esm/stdlib/behavior/track-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/types.d.ts +13 -0
- package/esm/stdlib/behavior/types.js +2 -0
- package/esm/stdlib/behavior/types.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
- package/esm/stdlib/behavior/zoom-canvas-3d.js +7 -7
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.d.ts +1 -2
- package/esm/stdlib/behavior/zoom-canvas.js +20 -18
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/index.d.ts +3 -0
- package/esm/stdlib/data/index.js +4 -0
- package/esm/stdlib/data/index.js.map +1 -0
- package/esm/stdlib/data/mapNodeSize.d.ts +12 -0
- package/esm/stdlib/data/mapNodeSize.js +43 -0
- package/esm/stdlib/data/mapNodeSize.js.map +1 -0
- package/esm/stdlib/data/transformV4Data.d.ts +9 -0
- package/esm/stdlib/data/transformV4Data.js +142 -0
- package/esm/stdlib/data/transformV4Data.js.map +1 -0
- package/esm/stdlib/data/validateData.d.ts +9 -0
- package/esm/stdlib/data/validateData.js +103 -0
- package/esm/stdlib/data/validateData.js.map +1 -0
- package/esm/stdlib/index.d.ts +113 -69
- package/esm/stdlib/index.js +150 -53
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/combo/index.d.ts +2 -0
- package/esm/stdlib/item/combo/index.js +3 -0
- package/esm/stdlib/item/combo/index.js.map +1 -0
- package/esm/stdlib/item/combo/rect.d.ts +31 -0
- package/esm/stdlib/item/combo/rect.js +65 -0
- package/esm/stdlib/item/combo/rect.js.map +1 -0
- package/esm/stdlib/item/edge/base.d.ts +95 -5
- package/esm/stdlib/item/edge/base.js +106 -9
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/{lib/stdlib/item/edge/cubic-horizon.d.ts → esm/stdlib/item/edge/cubic-horizontal.d.ts} +6 -7
- package/esm/stdlib/item/edge/{cubic-horizon.js → cubic-horizontal.js} +18 -33
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -0
- package/esm/stdlib/item/edge/cubic-vertical.d.ts +7 -8
- package/esm/stdlib/item/edge/cubic-vertical.js +17 -32
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/esm/stdlib/item/edge/cubic.d.ts +7 -8
- package/esm/stdlib/item/edge/cubic.js +22 -5
- package/esm/stdlib/item/edge/cubic.js.map +1 -1
- package/esm/stdlib/item/edge/index.d.ts +5 -0
- package/esm/stdlib/item/edge/index.js +5 -0
- package/esm/stdlib/item/edge/index.js.map +1 -1
- package/esm/stdlib/item/edge/line.d.ts +1 -1
- package/esm/stdlib/item/edge/line.js +16 -1
- package/esm/stdlib/item/edge/line.js.map +1 -1
- package/esm/stdlib/item/edge/loop.d.ts +32 -0
- package/esm/stdlib/item/edge/loop.js +115 -0
- package/esm/stdlib/item/edge/loop.js.map +1 -0
- package/esm/stdlib/item/edge/polyline.d.ts +44 -0
- package/esm/stdlib/item/edge/polyline.js +92 -0
- package/esm/stdlib/item/edge/polyline.js.map +1 -0
- package/esm/stdlib/item/edge/quadratic.d.ts +5 -6
- package/esm/stdlib/item/edge/quadratic.js +31 -19
- package/esm/stdlib/item/edge/quadratic.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +121 -3
- package/esm/stdlib/item/node/base.js +158 -15
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.d.ts +23 -0
- package/esm/stdlib/item/node/base3d.js +24 -9
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/circle.js +5 -5
- package/esm/stdlib/item/node/circle.js.map +1 -1
- package/esm/stdlib/item/node/diamond.d.ts +32 -0
- package/esm/stdlib/item/node/diamond.js +79 -0
- package/esm/stdlib/item/node/diamond.js.map +1 -0
- package/esm/stdlib/item/node/donut.d.ts +70 -0
- package/esm/stdlib/item/node/donut.js +207 -0
- package/esm/stdlib/item/node/donut.js.map +1 -0
- package/esm/stdlib/item/node/ellipse.d.ts +32 -0
- package/esm/stdlib/item/node/ellipse.js +71 -0
- package/esm/stdlib/item/node/ellipse.js.map +1 -0
- package/esm/stdlib/item/node/hexagon.d.ts +33 -0
- package/esm/stdlib/item/node/hexagon.js +102 -0
- package/esm/stdlib/item/node/hexagon.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +7 -0
- package/esm/stdlib/item/node/index.js +7 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/item/node/modelRect.d.ts +61 -0
- package/esm/stdlib/item/node/modelRect.js +186 -0
- package/esm/stdlib/item/node/modelRect.js.map +1 -0
- package/esm/stdlib/item/node/rect.d.ts +1 -0
- package/esm/stdlib/item/node/rect.js +16 -0
- package/esm/stdlib/item/node/rect.js.map +1 -1
- package/esm/stdlib/item/node/star.d.ts +34 -0
- package/esm/stdlib/item/node/star.js +115 -0
- package/esm/stdlib/item/node/star.js.map +1 -0
- package/esm/stdlib/item/node/triangle.d.ts +44 -0
- package/esm/stdlib/item/node/triangle.js +177 -0
- package/esm/stdlib/item/node/triangle.js.map +1 -0
- package/esm/stdlib/plugin/fisheye/index.d.ts +32 -4
- package/esm/stdlib/plugin/fisheye/index.js +3 -2
- package/esm/stdlib/plugin/fisheye/index.js.map +1 -1
- package/esm/stdlib/plugin/grid/index.d.ts +36 -0
- package/esm/stdlib/plugin/grid/index.js +81 -0
- package/esm/stdlib/plugin/grid/index.js.map +1 -0
- package/esm/stdlib/plugin/history/combo-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/combo-command.js +21 -0
- package/esm/stdlib/plugin/history/combo-command.js.map +1 -0
- package/esm/stdlib/plugin/history/command.d.ts +18 -0
- package/esm/stdlib/plugin/history/command.js +51 -0
- package/esm/stdlib/plugin/history/command.js.map +1 -0
- package/esm/stdlib/plugin/history/index.d.ts +112 -0
- package/esm/stdlib/plugin/history/index.js +275 -0
- package/esm/stdlib/plugin/history/index.js.map +1 -0
- package/esm/stdlib/plugin/history/item-data-command.d.ts +14 -0
- package/esm/stdlib/plugin/history/item-data-command.js +63 -0
- package/esm/stdlib/plugin/history/item-data-command.js.map +1 -0
- package/esm/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/layer-updated-command.js +21 -0
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/history/state-updated-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/state-updated-command.js +20 -0
- package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.js +23 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/hull/bubbleset.d.ts +9 -0
- package/esm/stdlib/plugin/hull/bubbleset.js +592 -0
- package/esm/stdlib/plugin/hull/bubbleset.js.map +1 -0
- package/esm/stdlib/plugin/hull/convexHull.d.ts +14 -0
- package/esm/stdlib/plugin/hull/convexHull.js +56 -0
- package/esm/stdlib/plugin/hull/convexHull.js.map +1 -0
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +87 -0
- package/esm/stdlib/plugin/hull/hullComponent.js +382 -0
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -0
- package/esm/stdlib/plugin/hull/index.d.ts +59 -0
- package/esm/stdlib/plugin/hull/index.js +161 -0
- package/esm/stdlib/plugin/hull/index.js.map +1 -0
- package/esm/stdlib/plugin/hull/types.d.ts +15 -0
- package/esm/stdlib/plugin/hull/types.js +2 -0
- package/esm/stdlib/plugin/hull/types.js.map +1 -0
- package/esm/stdlib/plugin/hull/util.d.ts +77 -0
- package/esm/stdlib/plugin/hull/util.js +401 -0
- package/esm/stdlib/plugin/hull/util.js.map +1 -0
- package/esm/stdlib/plugin/index.d.ts +8 -0
- package/esm/stdlib/plugin/index.js +9 -0
- package/esm/stdlib/plugin/index.js.map +1 -0
- package/esm/stdlib/plugin/legend/index.d.ts +45 -3
- package/esm/stdlib/plugin/legend/index.js +51 -44
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/menu/index.d.ts +18 -5
- package/esm/stdlib/plugin/menu/index.js +4 -3
- package/esm/stdlib/plugin/menu/index.js.map +1 -1
- package/esm/stdlib/plugin/minimap/index.d.ts +11 -3
- package/esm/stdlib/plugin/minimap/index.js +19 -21
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +59 -0
- package/esm/stdlib/plugin/toolbar/index.js +215 -0
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -0
- package/esm/stdlib/plugin/tooltip/index.d.ts +24 -3
- package/esm/stdlib/plugin/tooltip/index.js +13 -12
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
- package/esm/stdlib/plugin/types.d.ts +8 -0
- package/esm/stdlib/plugin/types.js +2 -0
- package/esm/stdlib/plugin/types.js.map +1 -0
- package/esm/stdlib/theme/dark.d.ts +1 -2
- package/esm/stdlib/theme/dark.js +9 -1
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/index.d.ts +2 -0
- package/esm/stdlib/theme/index.js +3 -0
- package/esm/stdlib/theme/index.js.map +1 -0
- package/esm/stdlib/theme/light.d.ts +1 -2
- package/esm/stdlib/theme/light.js +12 -2
- package/esm/stdlib/theme/light.js.map +1 -1
- package/esm/stdlib/themeSolver/base.d.ts +1 -1
- package/esm/stdlib/themeSolver/base.js +1 -1
- package/esm/stdlib/themeSolver/base.js.map +1 -1
- package/esm/stdlib/themeSolver/index.d.ts +3 -0
- package/esm/stdlib/themeSolver/index.js +4 -0
- package/esm/stdlib/themeSolver/index.js.map +1 -0
- package/esm/stdlib/themeSolver/spec.d.ts +2 -4
- package/esm/stdlib/themeSolver/spec.js +2 -2
- package/esm/stdlib/themeSolver/spec.js.map +1 -1
- package/esm/stdlib/themeSolver/subject.d.ts +2 -4
- package/esm/stdlib/themeSolver/subject.js +2 -2
- package/esm/stdlib/themeSolver/subject.js.map +1 -1
- package/esm/types/behavior.js.map +1 -1
- package/esm/types/combo.d.ts +3 -4
- package/esm/types/common.d.ts +10 -0
- package/esm/types/data.d.ts +10 -4
- package/esm/types/edge.d.ts +17 -2
- package/esm/types/graph.d.ts +129 -16
- package/esm/types/history.d.ts +28 -0
- package/esm/types/history.js +6 -0
- package/esm/types/history.js.map +1 -0
- package/esm/types/hook.d.ts +25 -5
- package/esm/types/index.d.ts +11 -5
- package/esm/types/index.js.map +1 -1
- package/esm/types/item.d.ts +10 -4
- package/esm/types/item.js.map +1 -1
- package/esm/types/layout.d.ts +4 -1
- package/esm/types/loop.d.ts +21 -0
- package/esm/types/loop.js +12 -0
- package/esm/types/loop.js.map +1 -0
- package/esm/types/node.d.ts +87 -6
- package/esm/types/plugin.d.ts +4 -0
- package/esm/types/plugin.js +1 -1
- package/esm/types/plugin.js.map +1 -1
- package/esm/types/spec.d.ts +27 -10
- package/esm/types/theme.d.ts +76 -10
- package/esm/types/theme.js +1 -2
- package/esm/types/theme.js.map +1 -1
- package/esm/util/animate.d.ts +2 -2
- package/esm/util/animate.js +52 -17
- package/esm/util/animate.js.map +1 -1
- package/esm/util/array.d.ts +8 -0
- package/esm/util/array.js +11 -1
- package/esm/util/array.js.map +1 -1
- package/esm/util/arrow.d.ts +17 -0
- package/esm/util/arrow.js +56 -0
- package/esm/util/arrow.js.map +1 -0
- package/esm/util/bbox.d.ts +106 -0
- package/esm/util/bbox.js +255 -0
- package/esm/util/bbox.js.map +1 -0
- package/esm/util/behavior.d.ts +2 -0
- package/esm/util/behavior.js +12 -0
- package/esm/util/behavior.js.map +1 -0
- package/esm/util/canvas.d.ts +1 -2
- package/esm/util/canvas.js +3 -20
- package/esm/util/canvas.js.map +1 -1
- package/esm/util/data.d.ts +33 -2
- package/esm/util/data.js +117 -5
- package/esm/util/data.js.map +1 -1
- package/esm/util/event.d.ts +22 -2
- package/esm/util/event.js +54 -0
- package/esm/util/event.js.map +1 -1
- package/esm/util/extend.d.ts +8 -2
- package/esm/util/extend.js.map +1 -1
- package/esm/util/index.d.ts +41 -3
- package/esm/util/index.js +20 -1
- package/esm/util/index.js.map +1 -1
- package/esm/util/item.d.ts +1 -1
- package/esm/util/item.js +7 -5
- package/esm/util/item.js.map +1 -1
- package/esm/util/layout.d.ts +40 -0
- package/esm/util/layout.js +160 -0
- package/esm/util/layout.js.map +1 -0
- package/esm/util/loop.d.ts +37 -0
- package/esm/util/loop.js +104 -0
- package/esm/util/loop.js.map +1 -0
- package/esm/util/mapper.js +4 -9
- package/esm/util/mapper.js.map +1 -1
- package/esm/util/math.d.ts +15 -0
- package/esm/util/math.js +14 -0
- package/esm/util/math.js.map +1 -1
- package/esm/util/mock.d.ts +30 -0
- package/esm/util/mock.js +69 -0
- package/esm/util/mock.js.map +1 -0
- package/esm/util/path.d.ts +11 -0
- package/esm/util/path.js +44 -0
- package/esm/util/path.js.map +1 -0
- package/esm/util/point.d.ts +24 -2
- package/esm/util/point.js +27 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/polyline.d.ts +113 -0
- package/esm/util/polyline.js +505 -0
- package/esm/util/polyline.js.map +1 -0
- package/esm/util/router.d.ts +31 -0
- package/esm/util/router.js +380 -0
- package/esm/util/router.js.map +1 -0
- package/esm/util/shape.d.ts +3 -3
- package/esm/util/shape.js +19 -3
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.d.ts +1 -1
- package/esm/util/shape3d.js +12 -6
- package/esm/util/shape3d.js.map +1 -1
- package/esm/util/type.d.ts +6 -0
- package/esm/util/type.js +7 -1
- package/esm/util/type.js.map +1 -1
- package/esm/util/zoom.d.ts +1 -1
- package/esm/util/zoom.js +6 -2
- package/esm/util/zoom.js.map +1 -1
- package/lib/api-doc/behaviors.d.ts +2 -0
- package/lib/api-doc/behaviors.js +18 -0
- package/lib/api-doc/behaviors.js.map +1 -0
- package/lib/api-doc/graph.d.ts +4 -0
- package/lib/api-doc/graph.js +11 -0
- package/lib/api-doc/graph.js.map +1 -0
- package/lib/api-doc/item.d.ts +11 -0
- package/lib/api-doc/item.js +25 -0
- package/lib/api-doc/item.js.map +1 -0
- package/lib/api-doc/layout.d.ts +1 -0
- package/lib/api-doc/layout.js +3 -0
- package/lib/api-doc/layout.js.map +1 -0
- package/lib/api-doc/plugins.d.ts +1 -0
- package/lib/api-doc/plugins.js +18 -0
- package/lib/api-doc/plugins.js.map +1 -0
- package/lib/api-doc/types.d.ts +0 -0
- package/lib/api-doc/types.js +3 -0
- package/lib/api-doc/types.js.map +1 -0
- package/lib/api-doc/util.d.ts +3 -0
- package/lib/api-doc/util.js +10 -0
- package/lib/api-doc/util.js.map +1 -0
- package/lib/constant/shape.d.ts +7 -14
- package/lib/constant/shape.js +1 -0
- package/lib/constant/shape.js.map +1 -1
- package/lib/index.d.ts +213 -113
- package/lib/index.js +13 -3
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +13 -6
- package/lib/item/combo.js +72 -8
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +12 -9
- package/lib/item/edge.js +38 -11
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +8 -6
- package/lib/item/item.js +123 -80
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +14 -9
- package/lib/item/node.js +63 -48
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +17 -1
- package/lib/runtime/controller/data.js +319 -222
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/interaction.d.ts +1 -0
- package/lib/runtime/controller/interaction.js +7 -4
- package/lib/runtime/controller/interaction.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +37 -4
- package/lib/runtime/controller/item.js +474 -176
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.d.ts +4 -1
- package/lib/runtime/controller/layout.js +119 -14
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/controller/plugin.d.ts +11 -0
- package/lib/runtime/controller/plugin.js +39 -6
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/controller/theme.js +8 -4
- package/lib/runtime/controller/theme.js.map +1 -1
- package/lib/runtime/graph.d.ts +181 -39
- package/lib/runtime/graph.js +560 -71
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +2 -3
- package/lib/stdlib/behavior/activate-relations.js +14 -9
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.d.ts +3 -4
- package/lib/stdlib/behavior/brush-select.js +3 -2
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/click-select.d.ts +2 -3
- package/lib/stdlib/behavior/click-select.js +9 -6
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/collapse-expand-combo.d.ts +1 -2
- package/lib/stdlib/behavior/collapse-expand-combo.js +2 -1
- package/lib/stdlib/behavior/collapse-expand-combo.js.map +1 -1
- package/lib/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
- package/lib/stdlib/behavior/collapse-expand-tree.js +73 -0
- package/lib/stdlib/behavior/collapse-expand-tree.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +1 -2
- package/lib/stdlib/behavior/drag-canvas.js +23 -18
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +16 -4
- package/lib/stdlib/behavior/drag-combo.js +70 -30
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.d.ts +20 -4
- package/lib/stdlib/behavior/drag-node.js +145 -56
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/hover-activate.d.ts +1 -2
- package/lib/stdlib/behavior/hover-activate.js +2 -1
- package/lib/stdlib/behavior/hover-activate.js.map +1 -1
- package/lib/stdlib/behavior/index.d.ts +15 -0
- package/lib/stdlib/behavior/index.js +32 -0
- package/lib/stdlib/behavior/index.js.map +1 -0
- package/lib/stdlib/behavior/lasso-select.d.ts +7 -3
- package/lib/stdlib/behavior/lasso-select.js +4 -6
- package/lib/stdlib/behavior/lasso-select.js.map +1 -1
- package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
- package/lib/stdlib/behavior/orbit-canvas-3d.js +4 -6
- package/lib/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
- package/lib/stdlib/behavior/rotate-canvas-3d.js +2 -1
- package/lib/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/track-canvas-3d.d.ts +2 -3
- package/lib/stdlib/behavior/track-canvas-3d.js +4 -6
- package/lib/stdlib/behavior/track-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/types.d.ts +13 -0
- package/lib/stdlib/behavior/types.js +3 -0
- package/lib/stdlib/behavior/types.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
- package/lib/stdlib/behavior/zoom-canvas-3d.js +8 -7
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.d.ts +1 -2
- package/lib/stdlib/behavior/zoom-canvas.js +21 -18
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/index.d.ts +3 -0
- package/lib/stdlib/data/index.js +20 -0
- package/lib/stdlib/data/index.js.map +1 -0
- package/lib/stdlib/data/mapNodeSize.d.ts +12 -0
- package/lib/stdlib/data/mapNodeSize.js +47 -0
- package/lib/stdlib/data/mapNodeSize.js.map +1 -0
- package/lib/stdlib/data/transformV4Data.d.ts +9 -0
- package/lib/stdlib/data/transformV4Data.js +146 -0
- package/lib/stdlib/data/transformV4Data.js.map +1 -0
- package/lib/stdlib/data/validateData.d.ts +9 -0
- package/lib/stdlib/data/validateData.js +107 -0
- package/lib/stdlib/data/validateData.js.map +1 -0
- package/lib/stdlib/index.d.ts +113 -69
- package/lib/stdlib/index.js +188 -67
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/combo/index.d.ts +2 -0
- package/lib/stdlib/item/combo/index.js +19 -0
- package/lib/stdlib/item/combo/index.js.map +1 -0
- package/lib/stdlib/item/combo/rect.d.ts +31 -0
- package/lib/stdlib/item/combo/rect.js +69 -0
- package/lib/stdlib/item/combo/rect.js.map +1 -0
- package/lib/stdlib/item/edge/base.d.ts +95 -5
- package/lib/stdlib/item/edge/base.js +105 -8
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/{esm/stdlib/item/edge/cubic-horizon.d.ts → lib/stdlib/item/edge/cubic-horizontal.d.ts} +6 -7
- package/lib/stdlib/item/edge/{cubic-horizon.js → cubic-horizontal.js} +20 -35
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -0
- package/lib/stdlib/item/edge/cubic-vertical.d.ts +7 -8
- package/lib/stdlib/item/edge/cubic-vertical.js +17 -32
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/lib/stdlib/item/edge/cubic.d.ts +7 -8
- package/lib/stdlib/item/edge/cubic.js +22 -5
- package/lib/stdlib/item/edge/cubic.js.map +1 -1
- package/lib/stdlib/item/edge/index.d.ts +5 -0
- package/lib/stdlib/item/edge/index.js +5 -0
- package/lib/stdlib/item/edge/index.js.map +1 -1
- package/lib/stdlib/item/edge/line.d.ts +1 -1
- package/lib/stdlib/item/edge/line.js +16 -1
- package/lib/stdlib/item/edge/line.js.map +1 -1
- package/lib/stdlib/item/edge/loop.d.ts +32 -0
- package/lib/stdlib/item/edge/loop.js +119 -0
- package/lib/stdlib/item/edge/loop.js.map +1 -0
- package/lib/stdlib/item/edge/polyline.d.ts +44 -0
- package/lib/stdlib/item/edge/polyline.js +96 -0
- package/lib/stdlib/item/edge/polyline.js.map +1 -0
- package/lib/stdlib/item/edge/quadratic.d.ts +5 -6
- package/lib/stdlib/item/edge/quadratic.js +33 -21
- package/lib/stdlib/item/edge/quadratic.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +121 -3
- package/lib/stdlib/item/node/base.js +158 -15
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.d.ts +23 -0
- package/lib/stdlib/item/node/base3d.js +24 -9
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/circle.js +5 -5
- package/lib/stdlib/item/node/circle.js.map +1 -1
- package/lib/stdlib/item/node/diamond.d.ts +32 -0
- package/lib/stdlib/item/node/diamond.js +83 -0
- package/lib/stdlib/item/node/diamond.js.map +1 -0
- package/lib/stdlib/item/node/donut.d.ts +70 -0
- package/lib/stdlib/item/node/donut.js +211 -0
- package/lib/stdlib/item/node/donut.js.map +1 -0
- package/lib/stdlib/item/node/ellipse.d.ts +32 -0
- package/lib/stdlib/item/node/ellipse.js +75 -0
- package/lib/stdlib/item/node/ellipse.js.map +1 -0
- package/lib/stdlib/item/node/hexagon.d.ts +33 -0
- package/lib/stdlib/item/node/hexagon.js +106 -0
- package/lib/stdlib/item/node/hexagon.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +7 -0
- package/lib/stdlib/item/node/index.js +7 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/item/node/modelRect.d.ts +61 -0
- package/lib/stdlib/item/node/modelRect.js +190 -0
- package/lib/stdlib/item/node/modelRect.js.map +1 -0
- package/lib/stdlib/item/node/rect.d.ts +1 -0
- package/lib/stdlib/item/node/rect.js +16 -0
- package/lib/stdlib/item/node/rect.js.map +1 -1
- package/lib/stdlib/item/node/star.d.ts +34 -0
- package/lib/stdlib/item/node/star.js +119 -0
- package/lib/stdlib/item/node/star.js.map +1 -0
- package/lib/stdlib/item/node/triangle.d.ts +44 -0
- package/lib/stdlib/item/node/triangle.js +181 -0
- package/lib/stdlib/item/node/triangle.js.map +1 -0
- package/lib/stdlib/plugin/fisheye/index.d.ts +32 -4
- package/lib/stdlib/plugin/fisheye/index.js +3 -1
- package/lib/stdlib/plugin/fisheye/index.js.map +1 -1
- package/lib/stdlib/plugin/grid/index.d.ts +36 -0
- package/lib/stdlib/plugin/grid/index.js +85 -0
- package/lib/stdlib/plugin/grid/index.js.map +1 -0
- package/lib/stdlib/plugin/history/combo-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/combo-command.js +25 -0
- package/lib/stdlib/plugin/history/combo-command.js.map +1 -0
- package/lib/stdlib/plugin/history/command.d.ts +18 -0
- package/lib/stdlib/plugin/history/command.js +54 -0
- package/lib/stdlib/plugin/history/command.js.map +1 -0
- package/lib/stdlib/plugin/history/index.d.ts +112 -0
- package/lib/stdlib/plugin/history/index.js +283 -0
- package/lib/stdlib/plugin/history/index.js.map +1 -0
- package/lib/stdlib/plugin/history/item-data-command.d.ts +14 -0
- package/lib/stdlib/plugin/history/item-data-command.js +67 -0
- package/lib/stdlib/plugin/history/item-data-command.js.map +1 -0
- package/lib/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/layer-updated-command.js +25 -0
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/history/state-updated-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/state-updated-command.js +24 -0
- package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.js +27 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/hull/bubbleset.d.ts +9 -0
- package/lib/stdlib/plugin/hull/bubbleset.js +596 -0
- package/lib/stdlib/plugin/hull/bubbleset.js.map +1 -0
- package/lib/stdlib/plugin/hull/convexHull.d.ts +14 -0
- package/lib/stdlib/plugin/hull/convexHull.js +61 -0
- package/lib/stdlib/plugin/hull/convexHull.js.map +1 -0
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +87 -0
- package/lib/stdlib/plugin/hull/hullComponent.js +385 -0
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -0
- package/lib/stdlib/plugin/hull/index.d.ts +59 -0
- package/lib/stdlib/plugin/hull/index.js +167 -0
- package/lib/stdlib/plugin/hull/index.js.map +1 -0
- package/lib/stdlib/plugin/hull/types.d.ts +15 -0
- package/lib/stdlib/plugin/hull/types.js +3 -0
- package/lib/stdlib/plugin/hull/types.js.map +1 -0
- package/lib/stdlib/plugin/hull/util.d.ts +77 -0
- package/lib/stdlib/plugin/hull/util.js +419 -0
- package/lib/stdlib/plugin/hull/util.js.map +1 -0
- package/lib/stdlib/plugin/index.d.ts +8 -0
- package/lib/stdlib/plugin/index.js +25 -0
- package/lib/stdlib/plugin/index.js.map +1 -0
- package/lib/stdlib/plugin/legend/index.d.ts +45 -3
- package/lib/stdlib/plugin/legend/index.js +50 -42
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/menu/index.d.ts +18 -5
- package/lib/stdlib/plugin/menu/index.js +5 -3
- package/lib/stdlib/plugin/menu/index.js.map +1 -1
- package/lib/stdlib/plugin/minimap/index.d.ts +11 -3
- package/lib/stdlib/plugin/minimap/index.js +19 -20
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +59 -0
- package/lib/stdlib/plugin/toolbar/index.js +222 -0
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -0
- package/lib/stdlib/plugin/tooltip/index.d.ts +24 -3
- package/lib/stdlib/plugin/tooltip/index.js +14 -12
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
- package/lib/stdlib/plugin/types.d.ts +8 -0
- package/lib/stdlib/plugin/types.js +3 -0
- package/lib/stdlib/plugin/types.js.map +1 -0
- package/lib/stdlib/theme/dark.d.ts +1 -2
- package/lib/stdlib/theme/dark.js +10 -1
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/index.d.ts +2 -0
- package/lib/stdlib/theme/index.js +19 -0
- package/lib/stdlib/theme/index.js.map +1 -0
- package/lib/stdlib/theme/light.d.ts +1 -2
- package/lib/stdlib/theme/light.js +13 -2
- package/lib/stdlib/theme/light.js.map +1 -1
- package/lib/stdlib/themeSolver/base.d.ts +1 -1
- package/lib/stdlib/themeSolver/base.js +2 -1
- package/lib/stdlib/themeSolver/base.js.map +1 -1
- package/lib/stdlib/themeSolver/index.d.ts +3 -0
- package/lib/stdlib/themeSolver/index.js +20 -0
- package/lib/stdlib/themeSolver/index.js.map +1 -0
- package/lib/stdlib/themeSolver/spec.d.ts +2 -4
- package/lib/stdlib/themeSolver/spec.js +4 -6
- package/lib/stdlib/themeSolver/spec.js.map +1 -1
- package/lib/stdlib/themeSolver/subject.d.ts +2 -4
- package/lib/stdlib/themeSolver/subject.js +4 -4
- package/lib/stdlib/themeSolver/subject.js.map +1 -1
- package/lib/types/behavior.js.map +1 -1
- package/lib/types/combo.d.ts +3 -4
- package/lib/types/common.d.ts +10 -0
- package/lib/types/data.d.ts +10 -4
- package/lib/types/edge.d.ts +17 -2
- package/lib/types/graph.d.ts +129 -16
- package/lib/types/history.d.ts +28 -0
- package/lib/types/history.js +9 -0
- package/lib/types/history.js.map +1 -0
- package/lib/types/hook.d.ts +25 -5
- package/lib/types/index.d.ts +11 -5
- package/lib/types/index.js.map +1 -1
- package/lib/types/item.d.ts +10 -4
- package/lib/types/item.js.map +1 -1
- package/lib/types/layout.d.ts +4 -1
- package/lib/types/loop.d.ts +21 -0
- package/lib/types/loop.js +15 -0
- package/lib/types/loop.js.map +1 -0
- package/lib/types/node.d.ts +87 -6
- package/lib/types/plugin.d.ts +4 -0
- package/lib/types/plugin.js.map +1 -1
- package/lib/types/spec.d.ts +27 -10
- package/lib/types/theme.d.ts +76 -10
- package/lib/types/theme.js +1 -2
- package/lib/types/theme.js.map +1 -1
- package/lib/util/animate.d.ts +2 -2
- package/lib/util/animate.js +52 -17
- package/lib/util/animate.js.map +1 -1
- package/lib/util/array.d.ts +8 -0
- package/lib/util/array.js +13 -2
- package/lib/util/array.js.map +1 -1
- package/lib/util/arrow.d.ts +17 -0
- package/lib/util/arrow.js +60 -0
- package/lib/util/arrow.js.map +1 -0
- package/lib/util/bbox.d.ts +106 -0
- package/lib/util/bbox.js +273 -0
- package/lib/util/bbox.js.map +1 -0
- package/lib/util/behavior.d.ts +2 -0
- package/lib/util/behavior.js +16 -0
- package/lib/util/behavior.js.map +1 -0
- package/lib/util/canvas.d.ts +1 -2
- package/lib/util/canvas.js +3 -20
- package/lib/util/canvas.js.map +1 -1
- package/lib/util/data.d.ts +33 -2
- package/lib/util/data.js +121 -6
- package/lib/util/data.js.map +1 -1
- package/lib/util/event.d.ts +22 -2
- package/lib/util/event.js +56 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/extend.d.ts +8 -2
- package/lib/util/extend.js.map +1 -1
- package/lib/util/index.d.ts +41 -3
- package/lib/util/index.js +20 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/item.d.ts +1 -1
- package/lib/util/item.js +7 -5
- package/lib/util/item.js.map +1 -1
- package/lib/util/layout.d.ts +40 -0
- package/lib/util/layout.js +172 -0
- package/lib/util/layout.js.map +1 -0
- package/lib/util/loop.d.ts +37 -0
- package/lib/util/loop.js +111 -0
- package/lib/util/loop.js.map +1 -0
- package/lib/util/mapper.js +4 -9
- package/lib/util/mapper.js.map +1 -1
- package/lib/util/math.d.ts +15 -0
- package/lib/util/math.js +17 -1
- package/lib/util/math.js.map +1 -1
- package/lib/util/mock.d.ts +30 -0
- package/lib/util/mock.js +73 -0
- package/lib/util/mock.js.map +1 -0
- package/lib/util/path.d.ts +11 -0
- package/lib/util/path.js +49 -0
- package/lib/util/path.js.map +1 -0
- package/lib/util/point.d.ts +24 -2
- package/lib/util/point.js +31 -3
- package/lib/util/point.js.map +1 -1
- package/lib/util/polyline.d.ts +113 -0
- package/lib/util/polyline.js +524 -0
- package/lib/util/polyline.js.map +1 -0
- package/lib/util/router.d.ts +31 -0
- package/lib/util/router.js +384 -0
- package/lib/util/router.js.map +1 -0
- package/lib/util/shape.d.ts +3 -3
- package/lib/util/shape.js +19 -3
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.d.ts +1 -1
- package/lib/util/shape3d.js +11 -5
- package/lib/util/shape3d.js.map +1 -1
- package/lib/util/type.d.ts +6 -0
- package/lib/util/type.js +9 -2
- package/lib/util/type.js.map +1 -1
- package/lib/util/zoom.d.ts +1 -1
- package/lib/util/zoom.js +6 -2
- package/lib/util/zoom.js.map +1 -1
- package/package.json +35 -15
- package/src/api-doc/behaviors.ts +2 -0
- package/src/api-doc/graph.ts +4 -0
- package/src/api-doc/item.ts +45 -0
- package/src/api-doc/layout.ts +13 -0
- package/src/api-doc/plugins.ts +1 -0
- package/src/api-doc/readme.md +59 -0
- package/src/api-doc/types.ts +2 -0
- package/src/api-doc/util.ts +3 -0
- package/src/constant/shape.ts +4 -1
- package/src/index.ts +14 -4
- package/src/item/combo.ts +105 -18
- package/src/item/edge.ts +68 -18
- package/src/item/item.ts +138 -82
- package/src/item/node.ts +100 -54
- package/src/runtime/controller/data.ts +411 -259
- package/src/runtime/controller/interaction.ts +8 -4
- package/src/runtime/controller/item.ts +690 -252
- package/src/runtime/controller/layout.ts +147 -14
- package/src/runtime/controller/plugin.ts +59 -10
- package/src/runtime/controller/theme.ts +8 -4
- package/src/runtime/graph.ts +721 -130
- package/src/stdlib/behavior/activate-relations.ts +14 -11
- package/src/stdlib/behavior/brush-select.ts +4 -5
- package/src/stdlib/behavior/click-select.ts +12 -10
- package/src/stdlib/behavior/collapse-expand-combo.ts +1 -3
- package/src/stdlib/behavior/collapse-expand-tree.ts +106 -0
- package/src/stdlib/behavior/drag-canvas.ts +22 -20
- package/src/stdlib/behavior/drag-combo.ts +109 -53
- package/src/stdlib/behavior/drag-node.ts +220 -83
- package/src/stdlib/behavior/hover-activate.ts +1 -2
- package/src/stdlib/behavior/index.ts +15 -0
- package/src/stdlib/behavior/lasso-select.ts +6 -2
- package/src/stdlib/behavior/orbit-canvas-3d.ts +2 -4
- package/src/stdlib/behavior/rotate-canvas-3d.ts +1 -3
- package/src/stdlib/behavior/track-canvas-3d.ts +2 -4
- package/src/stdlib/behavior/types.ts +15 -0
- package/src/stdlib/behavior/zoom-canvas-3d.ts +5 -7
- package/src/stdlib/behavior/zoom-canvas.ts +19 -19
- package/src/stdlib/data/index.ts +3 -0
- package/src/stdlib/data/mapNodeSize.ts +67 -0
- package/src/stdlib/data/transformV4Data.ts +207 -0
- package/src/stdlib/data/validateData.ts +151 -0
- package/src/stdlib/index.ts +215 -53
- package/src/stdlib/item/combo/index.ts +2 -0
- package/src/stdlib/item/combo/rect.ts +123 -0
- package/src/stdlib/item/edge/base.ts +156 -8
- package/src/stdlib/item/edge/{cubic-horizon.ts → cubic-horizontal.ts} +25 -53
- package/src/stdlib/item/edge/cubic-vertical.ts +24 -55
- package/src/stdlib/item/edge/cubic.ts +36 -36
- package/src/stdlib/item/edge/index.ts +5 -0
- package/src/stdlib/item/edge/line.ts +14 -15
- package/src/stdlib/item/edge/loop.ts +162 -0
- package/src/stdlib/item/edge/polyline.ts +161 -0
- package/src/stdlib/item/edge/quadratic.ts +34 -37
- package/src/stdlib/item/node/base.ts +195 -15
- package/src/stdlib/item/node/base3d.ts +25 -9
- package/src/stdlib/item/node/circle.ts +5 -5
- package/src/stdlib/item/node/diamond.ts +144 -0
- package/src/stdlib/item/node/donut.ts +368 -0
- package/src/stdlib/item/node/ellipse.ts +128 -0
- package/src/stdlib/item/node/hexagon.ts +168 -0
- package/src/stdlib/item/node/index.ts +7 -0
- package/src/stdlib/item/node/modelRect.ts +405 -0
- package/src/stdlib/item/node/rect.ts +17 -0
- package/src/stdlib/item/node/star.ts +181 -0
- package/src/stdlib/item/node/triangle.ts +265 -0
- package/src/stdlib/plugin/fisheye/index.ts +35 -6
- package/src/stdlib/plugin/grid/index.ts +125 -0
- package/src/stdlib/plugin/history/combo-command.ts +28 -0
- package/src/stdlib/plugin/history/command.ts +81 -0
- package/src/stdlib/plugin/history/index.ts +347 -0
- package/src/stdlib/plugin/history/item-data-command.ts +96 -0
- package/src/stdlib/plugin/history/layer-updated-command.ts +28 -0
- package/src/stdlib/plugin/history/state-updated-command.ts +36 -0
- package/src/stdlib/plugin/history/visibility-updated-command.ts +41 -0
- package/src/stdlib/plugin/hull/bubbleset.ts +828 -0
- package/src/stdlib/plugin/hull/convexHull.ts +68 -0
- package/src/stdlib/plugin/hull/hullComponent.ts +501 -0
- package/src/stdlib/plugin/hull/index.ts +234 -0
- package/src/stdlib/plugin/hull/types.ts +15 -0
- package/src/stdlib/plugin/hull/util.ts +511 -0
- package/src/stdlib/plugin/index.ts +8 -0
- package/src/stdlib/plugin/legend/index.ts +126 -64
- package/src/stdlib/plugin/menu/index.ts +21 -6
- package/src/stdlib/plugin/minimap/index.ts +35 -26
- package/src/stdlib/plugin/toolbar/index.ts +257 -0
- package/src/stdlib/plugin/tooltip/index.ts +38 -18
- package/src/stdlib/plugin/types.ts +8 -0
- package/src/stdlib/theme/dark.ts +9 -1
- package/src/stdlib/theme/index.ts +2 -0
- package/src/stdlib/theme/light.ts +13 -3
- package/src/stdlib/themeSolver/base.ts +1 -1
- package/src/stdlib/themeSolver/index.ts +3 -0
- package/src/stdlib/themeSolver/spec.ts +2 -5
- package/src/stdlib/themeSolver/subject.ts +2 -5
- package/src/types/behavior.ts +0 -1
- package/src/types/combo.ts +3 -4
- package/src/types/common.ts +13 -0
- package/src/types/data.ts +23 -4
- package/src/types/edge.ts +28 -4
- package/src/types/graph.ts +161 -11
- package/src/types/history.ts +30 -0
- package/src/types/hook.ts +29 -6
- package/src/types/index.ts +37 -12
- package/src/types/item.ts +15 -2
- package/src/types/layout.ts +20 -16
- package/src/types/loop.ts +23 -0
- package/src/types/node.ts +91 -11
- package/src/types/plugin.ts +7 -1
- package/src/types/spec.ts +31 -14
- package/src/types/theme.ts +80 -10
- package/src/util/animate.ts +58 -17
- package/src/util/array.ts +12 -1
- package/src/util/arrow.ts +62 -0
- package/src/util/bbox.ts +298 -0
- package/src/util/behavior.ts +14 -0
- package/src/util/canvas.ts +6 -24
- package/src/util/data.ts +134 -5
- package/src/util/event.ts +86 -2
- package/src/util/extend.ts +8 -2
- package/src/util/index.ts +31 -1
- package/src/util/item.ts +11 -8
- package/src/util/layout.ts +165 -0
- package/src/util/loop.ts +145 -0
- package/src/util/mapper.ts +10 -9
- package/src/util/math.ts +24 -0
- package/src/util/mock.ts +72 -0
- package/src/util/path.ts +52 -0
- package/src/util/point.ts +33 -2
- package/src/util/polyline.ts +676 -0
- package/src/util/router.ts +552 -0
- package/src/util/shape.ts +23 -7
- package/src/util/shape3d.ts +16 -11
- package/src/util/type.ts +8 -1
- package/src/util/zoom.ts +7 -3
- package/esm/stdlib/data/comboFromNode.d.ts +0 -9
- package/esm/stdlib/data/comboFromNode.js +0 -28
- package/esm/stdlib/data/comboFromNode.js.map +0 -1
- package/esm/stdlib/item/edge/cubic-horizon.js.map +0 -1
- package/lib/stdlib/data/comboFromNode.d.ts +0 -9
- package/lib/stdlib/data/comboFromNode.js +0 -32
- package/lib/stdlib/data/comboFromNode.js.map +0 -1
- package/lib/stdlib/item/edge/cubic-horizon.js.map +0 -1
- package/src/stdlib/data/comboFromNode.ts +0 -28
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
import { deepMix, map } from '@antv/util';
|
|
2
|
+
import { PolyPoint } from 'types/common';
|
|
3
|
+
import { ID } from 'types';
|
|
4
|
+
import Node from '../item/node';
|
|
5
|
+
import { simplePathFinder, SortedArray } from './polyline';
|
|
6
|
+
import {
|
|
7
|
+
getBBoxWidth,
|
|
8
|
+
getBBoxHeight,
|
|
9
|
+
getExpandedBBox,
|
|
10
|
+
getExpandedBBoxPoint,
|
|
11
|
+
isSegmentCrossingBBox,
|
|
12
|
+
} from './bbox';
|
|
13
|
+
import { getLineIntersect } from './shape';
|
|
14
|
+
import { eulerDist, manhattanDist } from './math';
|
|
15
|
+
|
|
16
|
+
export interface RouterCfg {
|
|
17
|
+
/** Spacing between lines and points */
|
|
18
|
+
offset?: number;
|
|
19
|
+
/** Grid size */
|
|
20
|
+
gridSize?: number;
|
|
21
|
+
/** Maximum allowable rotation angle (radian) */
|
|
22
|
+
maxAllowedDirectionChange?: number;
|
|
23
|
+
/** Allowed edge directions */
|
|
24
|
+
directions?: any[];
|
|
25
|
+
/** Penalties */
|
|
26
|
+
penalties?: {};
|
|
27
|
+
/** Determine if use simple router for polyline when no obstacles */
|
|
28
|
+
simple?: boolean;
|
|
29
|
+
/** Function to calculate the distance between two points */
|
|
30
|
+
distFunc?: (p1: PolyPoint, p2: PolyPoint) => number;
|
|
31
|
+
/** Simplified function to find path */
|
|
32
|
+
fallbackRoute?: (
|
|
33
|
+
p1: PolyPoint,
|
|
34
|
+
p2: PolyPoint,
|
|
35
|
+
startNode?: Node,
|
|
36
|
+
endNode?: Node,
|
|
37
|
+
cfg?: RouterCfg,
|
|
38
|
+
) => PolyPoint[];
|
|
39
|
+
/** Maximum loops */
|
|
40
|
+
maximumLoops?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to automatically avoid other nodes (obstacles) on the path
|
|
43
|
+
* Defaults to false.
|
|
44
|
+
*/
|
|
45
|
+
obstacleAvoidance?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const defaultCfg: RouterCfg = {
|
|
49
|
+
obstacleAvoidance: false,
|
|
50
|
+
offset: 20,
|
|
51
|
+
maxAllowedDirectionChange: Math.PI / 2,
|
|
52
|
+
maximumLoops: 2000,
|
|
53
|
+
gridSize: 10,
|
|
54
|
+
directions: [
|
|
55
|
+
{ stepX: 1, stepY: 0 }, // right
|
|
56
|
+
{ stepX: -1, stepY: 0 }, // left
|
|
57
|
+
{ stepX: 0, stepY: 1 }, // bottom
|
|
58
|
+
{ stepX: 0, stepY: -1 }, // top
|
|
59
|
+
],
|
|
60
|
+
get penalties() {
|
|
61
|
+
return {
|
|
62
|
+
0: 0,
|
|
63
|
+
45: this.gridSize / 2,
|
|
64
|
+
90: this.gridSize / 2,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
distFunc: manhattanDist,
|
|
68
|
+
fallbackRoute: simplePathFinder,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const straightPath = (start: PolyPoint, end: PolyPoint): PolyPoint[] => {
|
|
72
|
+
return [start, end];
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const octolinearCfg: RouterCfg = {
|
|
76
|
+
maxAllowedDirectionChange: Math.PI / 4,
|
|
77
|
+
directions: [
|
|
78
|
+
{ stepX: 1, stepY: 0 },
|
|
79
|
+
{ stepX: 1, stepY: 1 },
|
|
80
|
+
{ stepX: 0, stepY: 1 },
|
|
81
|
+
{ stepX: -1, stepY: 1 },
|
|
82
|
+
{ stepX: -1, stepY: 0 },
|
|
83
|
+
{ stepX: -1, stepY: -1 },
|
|
84
|
+
{ stepX: 0, stepY: -1 },
|
|
85
|
+
{ stepX: 1, stepY: -1 },
|
|
86
|
+
],
|
|
87
|
+
distFunc: eulerDist,
|
|
88
|
+
fallbackRoute: straightPath,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Calculates the index of a position in a grid based on grid size.
|
|
93
|
+
* @param pos position
|
|
94
|
+
* @param gridSize size of grid
|
|
95
|
+
* @returns index of the position in the grid
|
|
96
|
+
*/
|
|
97
|
+
const pos2GridIx = (pos: number, gridSize: number) => {
|
|
98
|
+
const gridIx = Math.round(Math.abs(pos / gridSize));
|
|
99
|
+
const sign = pos < 0 ? -1 : 1;
|
|
100
|
+
return gridIx < 0 ? 0 : sign * gridIx;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const getObstacleMap = (
|
|
104
|
+
items: Map<ID, Node>,
|
|
105
|
+
gridSize: number,
|
|
106
|
+
offset: number,
|
|
107
|
+
) => {
|
|
108
|
+
const obstacleMap = {};
|
|
109
|
+
items.forEach((item: Node) => {
|
|
110
|
+
if (!item || !item.isVisible()) return;
|
|
111
|
+
const bbox = getExpandedBBox(item.getBBox(), offset);
|
|
112
|
+
for (
|
|
113
|
+
let x = pos2GridIx(bbox.min[0], gridSize);
|
|
114
|
+
x <= pos2GridIx(bbox.max[0], gridSize);
|
|
115
|
+
x += 1
|
|
116
|
+
) {
|
|
117
|
+
for (
|
|
118
|
+
let y = pos2GridIx(bbox.min[1], gridSize);
|
|
119
|
+
y <= pos2GridIx(bbox.max[1], gridSize);
|
|
120
|
+
y += 1
|
|
121
|
+
) {
|
|
122
|
+
obstacleMap[`${x}|||${y}`] = true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return obstacleMap;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Calculate angle between the ray from p1 to p2 (clockwise)
|
|
132
|
+
*/
|
|
133
|
+
const getDirectionAngle = (p1: PolyPoint, p2: PolyPoint) => {
|
|
134
|
+
const deltaX = p2.x - p1.x;
|
|
135
|
+
const deltaY = p2.y - p1.y;
|
|
136
|
+
if (deltaX || deltaY) {
|
|
137
|
+
return Math.atan2(deltaY, deltaX);
|
|
138
|
+
}
|
|
139
|
+
return 0;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Get changed direction angle and make sure less than 180 degrees
|
|
144
|
+
*/
|
|
145
|
+
const getAngleDiff = (angle1: number, angle2: number) => {
|
|
146
|
+
const directionChange = Math.abs(angle1 - angle2);
|
|
147
|
+
return directionChange > Math.PI
|
|
148
|
+
? 2 * Math.PI - directionChange
|
|
149
|
+
: directionChange;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* estimated cost from the starting point to the end point after passing through the current point
|
|
154
|
+
*/
|
|
155
|
+
const estimateCost = (from: PolyPoint, endPoints: PolyPoint[], distFunc) => {
|
|
156
|
+
let min = Infinity;
|
|
157
|
+
for (let i = 0, len = endPoints.length; i < len; i++) {
|
|
158
|
+
const cost = distFunc(from, endPoints[i]);
|
|
159
|
+
if (cost < min) {
|
|
160
|
+
min = cost;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return min;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Calculate the connection points on the expanded BBox
|
|
168
|
+
* @param point anchorPoint of the position formatted by gridSize
|
|
169
|
+
* @param oriPoint anchorPoint of the position not formatted by gridSize
|
|
170
|
+
* @param node original node
|
|
171
|
+
* @param anotherPoint another point which position is formatted
|
|
172
|
+
* @param cfg router config
|
|
173
|
+
* @returns
|
|
174
|
+
*/
|
|
175
|
+
const getBoxPoints = (
|
|
176
|
+
point: PolyPoint,
|
|
177
|
+
oriPoint: PolyPoint,
|
|
178
|
+
node: Node,
|
|
179
|
+
anotherPoint: PolyPoint,
|
|
180
|
+
cfg: RouterCfg,
|
|
181
|
+
): PolyPoint[] => {
|
|
182
|
+
const points = [];
|
|
183
|
+
// create-edge 生成边的过程中,endNode 为 null
|
|
184
|
+
if (!node) {
|
|
185
|
+
return [point];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const { directions, offset } = cfg;
|
|
189
|
+
const bbox = node.getBBox();
|
|
190
|
+
const isInside =
|
|
191
|
+
oriPoint.x > bbox.min[0] &&
|
|
192
|
+
oriPoint.x < bbox.max[0] &&
|
|
193
|
+
oriPoint.y > bbox.min[1] &&
|
|
194
|
+
oriPoint.y < bbox.max[1];
|
|
195
|
+
|
|
196
|
+
const expandBBox = getExpandedBBox(bbox, offset);
|
|
197
|
+
|
|
198
|
+
for (const i in expandBBox) {
|
|
199
|
+
expandBBox[i] = map(expandBBox[i], (item: number) =>
|
|
200
|
+
pos2GridIx(item, cfg.gridSize),
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (isInside) {
|
|
205
|
+
// If the anchorPoint is inside the node, allow the first line to pass through the node
|
|
206
|
+
for (const dir of directions) {
|
|
207
|
+
const bounds = [
|
|
208
|
+
[
|
|
209
|
+
{
|
|
210
|
+
x: expandBBox.min[0],
|
|
211
|
+
y: expandBBox.min[1],
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
x: expandBBox.max[0],
|
|
215
|
+
y: expandBBox.min[1],
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
[
|
|
219
|
+
{
|
|
220
|
+
x: expandBBox.min[0],
|
|
221
|
+
y: expandBBox.min[1],
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
x: expandBBox.min[0],
|
|
225
|
+
y: expandBBox.max[1],
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
[
|
|
229
|
+
{
|
|
230
|
+
x: expandBBox.max[0],
|
|
231
|
+
y: expandBBox.min[1],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
x: expandBBox.max[0],
|
|
235
|
+
y: expandBBox.max[1],
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
[
|
|
239
|
+
{
|
|
240
|
+
x: expandBBox.min[0],
|
|
241
|
+
y: expandBBox.max[1],
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
x: expandBBox.max[0],
|
|
245
|
+
y: expandBBox.max[1],
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
];
|
|
249
|
+
for (let i = 0; i < 4; i++) {
|
|
250
|
+
const boundLine = bounds[i];
|
|
251
|
+
const insterctP = getLineIntersect(
|
|
252
|
+
point,
|
|
253
|
+
{
|
|
254
|
+
x: point.x + dir.stepX * getBBoxWidth(expandBBox),
|
|
255
|
+
y: point.y + dir.stepY * getBBoxHeight(expandBBox),
|
|
256
|
+
},
|
|
257
|
+
boundLine[0],
|
|
258
|
+
boundLine[1],
|
|
259
|
+
) as PolyPoint;
|
|
260
|
+
if (insterctP && !isSegmentCrossingBBox(point, insterctP, bbox)) {
|
|
261
|
+
insterctP.id = `${insterctP.x}|||${insterctP.y}`;
|
|
262
|
+
points.push(insterctP);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return points;
|
|
267
|
+
}
|
|
268
|
+
// If the anchorPoint is on the node, there is only one optional direction
|
|
269
|
+
const insterctP = getExpandedBBoxPoint(expandBBox, point, anotherPoint);
|
|
270
|
+
insterctP.id = `${insterctP.x}|||${insterctP.y}`;
|
|
271
|
+
return [insterctP];
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const getDirectionChange = (
|
|
275
|
+
current: PolyPoint,
|
|
276
|
+
neighbor: PolyPoint,
|
|
277
|
+
cameFrom: {
|
|
278
|
+
[key: string]: {
|
|
279
|
+
id: string;
|
|
280
|
+
x: number;
|
|
281
|
+
y: number;
|
|
282
|
+
};
|
|
283
|
+
},
|
|
284
|
+
scaleStartPoint: PolyPoint,
|
|
285
|
+
): number => {
|
|
286
|
+
const directionAngle = getDirectionAngle(current, neighbor);
|
|
287
|
+
const currentCameFrom = cameFrom[current.id];
|
|
288
|
+
if (!currentCameFrom) {
|
|
289
|
+
const startAngle = getDirectionAngle(scaleStartPoint, current);
|
|
290
|
+
return getAngleDiff(startAngle, directionAngle);
|
|
291
|
+
}
|
|
292
|
+
const prevDirectionAngle = getDirectionAngle(
|
|
293
|
+
{
|
|
294
|
+
x: currentCameFrom.x,
|
|
295
|
+
y: currentCameFrom.y,
|
|
296
|
+
},
|
|
297
|
+
current,
|
|
298
|
+
);
|
|
299
|
+
return getAngleDiff(prevDirectionAngle, directionAngle);
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
const getControlPoints = (
|
|
303
|
+
current,
|
|
304
|
+
cameFrom,
|
|
305
|
+
scaleStartPoint,
|
|
306
|
+
endPoint,
|
|
307
|
+
startPoint,
|
|
308
|
+
scaleEndPoint,
|
|
309
|
+
gridSize,
|
|
310
|
+
) => {
|
|
311
|
+
const controlPoints = [endPoint];
|
|
312
|
+
let pointZero = endPoint;
|
|
313
|
+
let currentId = current.id;
|
|
314
|
+
let currentX = current.x;
|
|
315
|
+
let currentY = current.y;
|
|
316
|
+
const lastPoint = {
|
|
317
|
+
x: currentX,
|
|
318
|
+
y: currentY,
|
|
319
|
+
id: currentId,
|
|
320
|
+
};
|
|
321
|
+
if (getDirectionChange(lastPoint, scaleEndPoint, cameFrom, scaleStartPoint)) {
|
|
322
|
+
pointZero = {
|
|
323
|
+
x: scaleEndPoint.x === endPoint.x ? endPoint.x : lastPoint.x * gridSize,
|
|
324
|
+
y: scaleEndPoint.y === endPoint.y ? endPoint.y : lastPoint.y * gridSize,
|
|
325
|
+
};
|
|
326
|
+
controlPoints.unshift(pointZero);
|
|
327
|
+
}
|
|
328
|
+
let currentCameFrom = cameFrom[currentId];
|
|
329
|
+
while (currentCameFrom && currentCameFrom.id !== currentId) {
|
|
330
|
+
const point = {
|
|
331
|
+
x: currentX,
|
|
332
|
+
y: currentY,
|
|
333
|
+
id: currentId,
|
|
334
|
+
};
|
|
335
|
+
const prePoint = {
|
|
336
|
+
x: currentCameFrom.x,
|
|
337
|
+
y: currentCameFrom.y,
|
|
338
|
+
id: currentCameFrom.id,
|
|
339
|
+
};
|
|
340
|
+
const directionChange = getDirectionChange(
|
|
341
|
+
prePoint,
|
|
342
|
+
point,
|
|
343
|
+
cameFrom,
|
|
344
|
+
scaleStartPoint,
|
|
345
|
+
);
|
|
346
|
+
if (directionChange) {
|
|
347
|
+
pointZero = {
|
|
348
|
+
x: prePoint.x === point.x ? pointZero.x : prePoint.x * gridSize,
|
|
349
|
+
y: prePoint.y === point.y ? pointZero.y : prePoint.y * gridSize,
|
|
350
|
+
};
|
|
351
|
+
controlPoints.unshift(pointZero);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
currentId = prePoint.id;
|
|
355
|
+
currentX = prePoint.x;
|
|
356
|
+
currentY = prePoint.y;
|
|
357
|
+
currentCameFrom = cameFrom[currentId];
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// Align with startNode
|
|
361
|
+
controlPoints[0].x =
|
|
362
|
+
currentX === scaleStartPoint.x ? startPoint.x : pointZero.x;
|
|
363
|
+
controlPoints[0].y =
|
|
364
|
+
currentY === scaleStartPoint.y ? startPoint.y : pointZero.y;
|
|
365
|
+
controlPoints.unshift(startPoint);
|
|
366
|
+
return controlPoints;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
/** Find the shortest path computed by A* routing algorithm */
|
|
370
|
+
export const pathFinder = (
|
|
371
|
+
sourceNodeId: ID,
|
|
372
|
+
targetNodeId: ID,
|
|
373
|
+
nodeMap: Map<ID, Node>,
|
|
374
|
+
routerCfg?: RouterCfg,
|
|
375
|
+
): PolyPoint[] => {
|
|
376
|
+
const startNode = nodeMap.get(sourceNodeId);
|
|
377
|
+
const endNode = nodeMap.get(targetNodeId);
|
|
378
|
+
|
|
379
|
+
const startPoint: PolyPoint = startNode.getPosition();
|
|
380
|
+
const endPoint: PolyPoint = endNode.getPosition();
|
|
381
|
+
|
|
382
|
+
if (isNaN(startPoint.x) || isNaN(endPoint.x)) return [];
|
|
383
|
+
const cfg: RouterCfg = deepMix(defaultCfg, routerCfg);
|
|
384
|
+
|
|
385
|
+
if (!cfg.obstacleAvoidance) {
|
|
386
|
+
return cfg.fallbackRoute(startPoint, endPoint, startNode, endNode, cfg);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const { penalties, gridSize } = cfg;
|
|
390
|
+
|
|
391
|
+
const obstacleMap = getObstacleMap(nodeMap, gridSize, cfg.offset);
|
|
392
|
+
|
|
393
|
+
const scaleStartPoint = {
|
|
394
|
+
x: pos2GridIx(startPoint.x, gridSize),
|
|
395
|
+
y: pos2GridIx(startPoint.y, gridSize),
|
|
396
|
+
};
|
|
397
|
+
const scaleEndPoint = {
|
|
398
|
+
x: pos2GridIx(endPoint.x, gridSize),
|
|
399
|
+
y: pos2GridIx(endPoint.y, gridSize),
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
startPoint.id = `${scaleStartPoint.x}|||${scaleStartPoint.y}`;
|
|
403
|
+
endPoint.id = `${scaleEndPoint.x}|||${scaleEndPoint.y}`;
|
|
404
|
+
const startPoints = getBoxPoints(
|
|
405
|
+
scaleStartPoint,
|
|
406
|
+
startPoint,
|
|
407
|
+
startNode,
|
|
408
|
+
scaleEndPoint,
|
|
409
|
+
cfg,
|
|
410
|
+
);
|
|
411
|
+
const endPoints = getBoxPoints(
|
|
412
|
+
scaleEndPoint,
|
|
413
|
+
endPoint,
|
|
414
|
+
endNode,
|
|
415
|
+
scaleStartPoint,
|
|
416
|
+
cfg,
|
|
417
|
+
);
|
|
418
|
+
startPoints.forEach((point) => {
|
|
419
|
+
delete obstacleMap[point.id];
|
|
420
|
+
});
|
|
421
|
+
endPoints.forEach((point) => {
|
|
422
|
+
delete obstacleMap[point.id];
|
|
423
|
+
});
|
|
424
|
+
const openSet = {};
|
|
425
|
+
const closedSet = {};
|
|
426
|
+
const cameFrom: {
|
|
427
|
+
[key: string]: {
|
|
428
|
+
id: string;
|
|
429
|
+
x: number;
|
|
430
|
+
y: number;
|
|
431
|
+
};
|
|
432
|
+
} = {};
|
|
433
|
+
|
|
434
|
+
// cost generated from the starting point to the current point, default: Infinity
|
|
435
|
+
const gScore: {
|
|
436
|
+
[key: string]: number;
|
|
437
|
+
} = {};
|
|
438
|
+
|
|
439
|
+
// estimated cost from the starting point to the end point after passing through the current point, default: Infinity
|
|
440
|
+
const fScore: {
|
|
441
|
+
[key: string]: number;
|
|
442
|
+
} = {};
|
|
443
|
+
|
|
444
|
+
const sortedOpenSet = new SortedArray();
|
|
445
|
+
|
|
446
|
+
// initialize
|
|
447
|
+
for (let i = 0; i < startPoints.length; i++) {
|
|
448
|
+
const firstStep = startPoints[i];
|
|
449
|
+
openSet[firstStep.id] = firstStep;
|
|
450
|
+
gScore[firstStep.id] = 0;
|
|
451
|
+
fScore[firstStep.id] = estimateCost(firstStep, endPoints, cfg.distFunc);
|
|
452
|
+
sortedOpenSet.add({
|
|
453
|
+
id: firstStep.id,
|
|
454
|
+
value: fScore[firstStep.id],
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
let remainLoops = cfg.maximumLoops;
|
|
458
|
+
let current,
|
|
459
|
+
direction,
|
|
460
|
+
neighbor,
|
|
461
|
+
neighborCost,
|
|
462
|
+
costFromStart,
|
|
463
|
+
directionChange;
|
|
464
|
+
let curCost = Infinity;
|
|
465
|
+
const endPointMap = {};
|
|
466
|
+
endPoints.forEach((point) => {
|
|
467
|
+
endPointMap[`${point.x}|||${point.y}`] = true;
|
|
468
|
+
});
|
|
469
|
+
Object.keys(openSet).forEach((key) => {
|
|
470
|
+
const id = openSet[key].id;
|
|
471
|
+
if (fScore[id] <= curCost) {
|
|
472
|
+
curCost = fScore[id];
|
|
473
|
+
current = openSet[id];
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
while (Object.keys(openSet).length > 0 && remainLoops > 0) {
|
|
477
|
+
const minId = sortedOpenSet.minId((remainLoops + 1) % 30 === 0);
|
|
478
|
+
if (minId) {
|
|
479
|
+
current = openSet[minId];
|
|
480
|
+
} else {
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// If the point with the smallest fScore is the endpoint
|
|
485
|
+
if (endPointMap[`${current.x}|||${current.y}`]) {
|
|
486
|
+
return getControlPoints(
|
|
487
|
+
current,
|
|
488
|
+
cameFrom,
|
|
489
|
+
scaleStartPoint,
|
|
490
|
+
endPoint,
|
|
491
|
+
startPoint,
|
|
492
|
+
scaleEndPoint,
|
|
493
|
+
gridSize,
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
delete openSet[current.id];
|
|
498
|
+
sortedOpenSet.remove(current.id);
|
|
499
|
+
closedSet[current.id] = true;
|
|
500
|
+
|
|
501
|
+
// Get the candidate points of the next step
|
|
502
|
+
// Take a step in the direction of the candidate point
|
|
503
|
+
for (let i = 0; i < cfg.directions.length; i++) {
|
|
504
|
+
direction = cfg.directions[i];
|
|
505
|
+
const neighborId = `${Math.round(current.x) + direction.stepX}|||${
|
|
506
|
+
Math.round(current.y) + direction.stepY
|
|
507
|
+
}`;
|
|
508
|
+
neighbor = {
|
|
509
|
+
x: current.x + direction.stepX,
|
|
510
|
+
y: current.y + direction.stepY,
|
|
511
|
+
id: neighborId,
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
if (closedSet[neighborId]) continue;
|
|
515
|
+
directionChange = getDirectionChange(
|
|
516
|
+
current,
|
|
517
|
+
neighbor,
|
|
518
|
+
cameFrom,
|
|
519
|
+
scaleStartPoint,
|
|
520
|
+
);
|
|
521
|
+
if (directionChange > cfg.maxAllowedDirectionChange) continue;
|
|
522
|
+
if (obstacleMap[neighborId]) continue; // skip if intersects
|
|
523
|
+
|
|
524
|
+
// Add candidate points to openSet, and calculate the cost of each candidate point
|
|
525
|
+
if (!openSet[neighborId]) {
|
|
526
|
+
openSet[neighborId] = neighbor;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
const directionPenalties = penalties[directionChange];
|
|
530
|
+
neighborCost =
|
|
531
|
+
cfg.distFunc(current, neighbor) +
|
|
532
|
+
(isNaN(directionPenalties) ? gridSize : directionPenalties);
|
|
533
|
+
costFromStart = gScore[current.id] + neighborCost;
|
|
534
|
+
const neighborGScore = gScore[neighborId];
|
|
535
|
+
if (neighborGScore && costFromStart >= neighborGScore) {
|
|
536
|
+
continue;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
cameFrom[neighborId] = current;
|
|
540
|
+
gScore[neighborId] = costFromStart;
|
|
541
|
+
fScore[neighborId] =
|
|
542
|
+
costFromStart + estimateCost(neighbor, endPoints, cfg.distFunc);
|
|
543
|
+
|
|
544
|
+
sortedOpenSet.add({
|
|
545
|
+
id: neighborId,
|
|
546
|
+
value: fScore[neighborId],
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
remainLoops -= 1;
|
|
550
|
+
}
|
|
551
|
+
return cfg.fallbackRoute(startPoint, endPoint, startNode, endNode, cfg);
|
|
552
|
+
};
|
package/src/util/shape.ts
CHANGED
|
@@ -28,12 +28,12 @@ import {
|
|
|
28
28
|
} from '../types/item';
|
|
29
29
|
import { NodeDisplayModel, NodeShapeMap } from '../types/node';
|
|
30
30
|
import { ComboDisplayModel, IGraph } from '../types';
|
|
31
|
-
import { getShapeAnimateBeginStyles } from './animate';
|
|
32
|
-
import { isArrayOverlap } from './array';
|
|
33
|
-
import { isBetween } from './math';
|
|
34
31
|
import Node from '../item/node';
|
|
35
32
|
import Edge from '../item/edge';
|
|
36
33
|
import Combo from '../item/combo';
|
|
34
|
+
import { getShapeAnimateBeginStyles } from './animate';
|
|
35
|
+
import { isArrayOverlap } from './array';
|
|
36
|
+
import { isBetween } from './math';
|
|
37
37
|
|
|
38
38
|
export const ShapeTagMap = {
|
|
39
39
|
circle: Circle,
|
|
@@ -77,7 +77,7 @@ export const createShape = (
|
|
|
77
77
|
* @returns
|
|
78
78
|
*/
|
|
79
79
|
const findAnimateFields = (animates, timing, shapeId) => {
|
|
80
|
-
if (!animates?.[timing]) return [];
|
|
80
|
+
if (!animates?.[timing]?.length) return [];
|
|
81
81
|
let animateFields = [];
|
|
82
82
|
animates[timing].forEach(({ fields, shapeId: animateShapeId }) => {
|
|
83
83
|
if (animateShapeId === shapeId) {
|
|
@@ -120,6 +120,7 @@ export const upsertShape = (
|
|
|
120
120
|
if (!shape) {
|
|
121
121
|
// create
|
|
122
122
|
shape = createShape(type, style, id);
|
|
123
|
+
if (style.interactive === false) shape.interactive = false;
|
|
123
124
|
// find the animate styles, set them to be INIT_SHAPE_STYLES
|
|
124
125
|
if (!disableAnimate && animates) {
|
|
125
126
|
const animateFields = findAnimateFields(
|
|
@@ -165,6 +166,8 @@ export const upsertShape = (
|
|
|
165
166
|
if (isStyleAffectBBox(type, updateStyles)) {
|
|
166
167
|
shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, true);
|
|
167
168
|
}
|
|
169
|
+
if (style.interactive === false) shape.interactive = false;
|
|
170
|
+
else shape.interactive = true;
|
|
168
171
|
}
|
|
169
172
|
shapeMap[id] = shape;
|
|
170
173
|
return shape;
|
|
@@ -663,7 +666,7 @@ export const combineBounds = (
|
|
|
663
666
|
*/
|
|
664
667
|
export const getCombinedBoundsByData = (
|
|
665
668
|
graph: IGraph,
|
|
666
|
-
models:
|
|
669
|
+
models: (Node | Combo)[],
|
|
667
670
|
):
|
|
668
671
|
| {
|
|
669
672
|
center: Tuple3Number;
|
|
@@ -680,9 +683,22 @@ export const getCombinedBoundsByData = (
|
|
|
680
683
|
size: [0, 0, 0],
|
|
681
684
|
};
|
|
682
685
|
let validCounts = 0;
|
|
683
|
-
models.forEach((
|
|
684
|
-
const bounds = graph.getRenderBBox(id);
|
|
686
|
+
models.forEach((item) => {
|
|
687
|
+
const bounds = graph.getRenderBBox(item.model.id);
|
|
685
688
|
if (bounds) {
|
|
689
|
+
if (item.model.data._isCombo) {
|
|
690
|
+
// child is combo, move to the correct center
|
|
691
|
+
const { center: childComboCenter } =
|
|
692
|
+
(item as Combo).getCombinedBounds() || {};
|
|
693
|
+
if (childComboCenter) {
|
|
694
|
+
['min', 'max', 'center'].forEach((field) => {
|
|
695
|
+
bounds[field] = bounds[field].map(
|
|
696
|
+
(val, i) => val - bounds.center[i] + childComboCenter[i],
|
|
697
|
+
);
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
686
702
|
validCounts++;
|
|
687
703
|
const { min, max } = bounds;
|
|
688
704
|
min.forEach((val, i) => {
|
package/src/util/shape3d.ts
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import { DisplayObject, Group } from '@antv/g';
|
|
2
2
|
import {
|
|
3
|
-
ProceduralGeometry,
|
|
4
3
|
SphereGeometry,
|
|
5
4
|
CubeGeometry,
|
|
6
5
|
Mesh,
|
|
7
6
|
MeshBasicMaterial,
|
|
7
|
+
MeshLambertMaterial,
|
|
8
8
|
MeshPhongMaterial,
|
|
9
9
|
PlaneGeometry,
|
|
10
10
|
} from '@antv/g-plugin-3d';
|
|
11
11
|
import { EdgeShapeMap } from '../types/edge';
|
|
12
12
|
import { NodeShapeMap } from '../types/node';
|
|
13
|
-
import {
|
|
14
|
-
GShapeStyle,
|
|
15
|
-
SHAPE_TYPE,
|
|
16
|
-
SHAPE_TYPE_3D,
|
|
17
|
-
ShapeStyle,
|
|
18
|
-
} from '../types/item';
|
|
13
|
+
import { GShapeStyle, SHAPE_TYPE, SHAPE_TYPE_3D } from '../types/item';
|
|
19
14
|
import {
|
|
20
15
|
LOCAL_BOUNDS_DIRTY_FLAG_KEY,
|
|
21
16
|
createShape,
|
|
@@ -41,8 +36,8 @@ export const createShape3D = (
|
|
|
41
36
|
return createShape(type as SHAPE_TYPE, style, id);
|
|
42
37
|
}
|
|
43
38
|
|
|
44
|
-
// materialType: 'phong' | 'basic', TODO: type
|
|
45
|
-
const { materialType = '
|
|
39
|
+
// materialType: 'lambert' | 'phong' | 'basic', TODO: type
|
|
40
|
+
const { materialType = 'lambert', ...otherStyles } = style as any;
|
|
46
41
|
if (!device.GeometryCache) {
|
|
47
42
|
device.GeometryCache = {};
|
|
48
43
|
}
|
|
@@ -70,8 +65,7 @@ export const createShape3D = (
|
|
|
70
65
|
device,
|
|
71
66
|
);
|
|
72
67
|
break;
|
|
73
|
-
case 'phong':
|
|
74
|
-
default: {
|
|
68
|
+
case 'phong': {
|
|
75
69
|
const materialProps = {
|
|
76
70
|
shininess: 30,
|
|
77
71
|
};
|
|
@@ -80,11 +74,20 @@ export const createShape3D = (
|
|
|
80
74
|
materialProps,
|
|
81
75
|
);
|
|
82
76
|
}
|
|
77
|
+
case 'lambert':
|
|
78
|
+
default: {
|
|
79
|
+
device.MaterialCache[materialType as string] = new MeshLambertMaterial(
|
|
80
|
+
device,
|
|
81
|
+
);
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
const shape = new Mesh({
|
|
87
88
|
style: {
|
|
89
|
+
visibility: 'visible',
|
|
90
|
+
strokeOpacity: 0,
|
|
88
91
|
...otherStyles,
|
|
89
92
|
geometry: cachedGeometry,
|
|
90
93
|
material: device.MaterialCache[materialType as string],
|
|
@@ -127,10 +130,12 @@ export const upsertShape3D = (
|
|
|
127
130
|
): DisplayObject => {
|
|
128
131
|
let shape = shapeMap[id];
|
|
129
132
|
if (!shape) {
|
|
133
|
+
// @ts-ignore
|
|
130
134
|
shape = createShape3D(type, style, id, device);
|
|
131
135
|
shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, true);
|
|
132
136
|
} else if (shape.nodeName !== type) {
|
|
133
137
|
shape.remove();
|
|
138
|
+
// @ts-ignore
|
|
134
139
|
shape = createShape3D(type, style, id, device);
|
|
135
140
|
shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, true);
|
|
136
141
|
} else {
|
package/src/util/type.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { Encode } from '../types/item';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Whether value is a Encode<T> type with fields and formatter function.
|
|
5
|
+
* @param value
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
3
8
|
export const isEncode = (value): value is Encode<any> =>
|
|
4
|
-
Boolean((value as Encode<any>)
|
|
9
|
+
Boolean((value as Encode<any>)?.fields && (value as Encode<any>).formatter);
|
|
10
|
+
|
|
11
|
+
export const convertToNumber = (_: unknown) => _ as number;
|