@antv/g6 5.0.0-alpha.8 → 5.0.0-beta.0
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 +6 -19
- 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 +9 -0
- package/esm/api-doc/item.js +3 -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 +215 -95
- package/esm/index.js +11 -4
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +79 -2
- package/esm/item/combo.js +186 -2
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +15 -12
- package/esm/item/edge.js +40 -14
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +12 -10
- package/esm/item/item.js +155 -83
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +32 -23
- package/esm/item/node.js +70 -49
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +28 -4
- package/esm/runtime/controller/data.js +562 -173
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/interaction.d.ts +1 -0
- package/esm/runtime/controller/interaction.js +23 -8
- package/esm/runtime/controller/interaction.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +47 -5
- package/esm/runtime/controller/item.js +712 -122
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.d.ts +4 -1
- package/esm/runtime/controller/layout.js +109 -13
- 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 +226 -47
- package/esm/runtime/graph.js +710 -90
- 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 +5 -3
- package/esm/stdlib/behavior/click-select.js +21 -7
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/collapse-expand-combo.d.ts +28 -0
- package/esm/stdlib/behavior/collapse-expand-combo.js +35 -0
- package/esm/stdlib/behavior/collapse-expand-combo.js.map +1 -0
- 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 +15 -11
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +111 -0
- package/esm/stdlib/behavior/drag-combo.js +380 -0
- package/esm/stdlib/behavior/drag-combo.js.map +1 -0
- package/esm/stdlib/behavior/drag-node.d.ts +33 -13
- package/esm/stdlib/behavior/drag-node.js +252 -67
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/hover-activate.d.ts +2 -1
- package/esm/stdlib/behavior/hover-activate.js +2 -0
- 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 +98 -0
- package/esm/stdlib/data/validateData.js.map +1 -0
- package/esm/stdlib/index.d.ts +115 -49
- package/esm/stdlib/index.js +156 -37
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/combo/circle.d.ts +29 -0
- package/esm/stdlib/item/combo/circle.js +56 -0
- package/esm/stdlib/item/combo/circle.js.map +1 -0
- 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 +12 -3
- package/esm/stdlib/item/edge/base.js +39 -5
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-horizontal.d.ts +36 -0
- package/esm/stdlib/item/edge/cubic-horizontal.js +56 -0
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -0
- package/esm/stdlib/item/edge/cubic-vertical.d.ts +36 -0
- package/esm/stdlib/item/edge/cubic-vertical.js +56 -0
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -0
- package/esm/stdlib/item/edge/cubic.d.ts +59 -0
- package/esm/stdlib/item/edge/cubic.js +116 -0
- package/esm/stdlib/item/edge/cubic.js.map +1 -0
- package/esm/stdlib/item/edge/index.d.ts +6 -0
- package/esm/stdlib/item/edge/index.js +6 -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 +40 -0
- package/esm/stdlib/item/edge/quadratic.js +78 -0
- package/esm/stdlib/item/edge/quadratic.js.map +1 -0
- package/esm/stdlib/item/node/base.d.ts +83 -38
- package/esm/stdlib/item/node/base.js +100 -15
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.js +1 -1
- 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 +8 -0
- package/esm/stdlib/item/node/index.js +8 -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 +32 -0
- package/esm/stdlib/item/node/rect.js +75 -0
- package/esm/stdlib/item/node/rect.js.map +1 -0
- 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 +130 -0
- package/esm/stdlib/plugin/fisheye/index.js +488 -0
- package/esm/stdlib/plugin/fisheye/index.js.map +1 -0
- 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 +47 -42
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/menu/index.d.ts +55 -0
- package/esm/stdlib/plugin/menu/index.js +237 -0
- package/esm/stdlib/plugin/menu/index.js.map +1 -0
- 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 +96 -0
- package/esm/stdlib/plugin/tooltip/index.js +378 -0
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -0
- 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 +13 -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 +65 -10
- 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 +51 -3
- package/esm/types/common.d.ts +10 -0
- package/esm/types/data.d.ts +13 -7
- package/esm/types/edge.d.ts +19 -5
- package/esm/types/event.d.ts +9 -1
- package/esm/types/event.js +8 -8
- package/esm/types/event.js.map +1 -1
- package/esm/types/graph.d.ts +169 -20
- 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 +33 -6
- package/esm/types/index.d.ts +11 -5
- package/esm/types/index.js.map +1 -1
- package/esm/types/item.d.ts +14 -8
- 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 +90 -10
- 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 +26 -9
- 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 +11 -20
- package/esm/util/canvas.js.map +1 -1
- package/esm/util/data.d.ts +96 -0
- package/esm/util/data.js +262 -0
- package/esm/util/data.js.map +1 -0
- package/esm/util/event.d.ts +29 -1
- package/esm/util/event.js +70 -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 +2 -1
- package/esm/util/item.js +38 -13
- 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 +39 -4
- package/esm/util/shape.js +118 -2
- 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 +2 -2
- 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 +9 -0
- package/lib/api-doc/item.js +21 -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 +215 -95
- package/lib/index.js +13 -3
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +79 -2
- package/lib/item/combo.js +186 -2
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +15 -12
- package/lib/item/edge.js +40 -14
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +12 -10
- package/lib/item/item.js +153 -81
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +32 -23
- package/lib/item/node.js +70 -49
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +28 -4
- package/lib/runtime/controller/data.js +561 -172
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/interaction.d.ts +1 -0
- package/lib/runtime/controller/interaction.js +22 -7
- package/lib/runtime/controller/interaction.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +47 -5
- package/lib/runtime/controller/item.js +710 -120
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.d.ts +4 -1
- package/lib/runtime/controller/layout.js +132 -13
- 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 +226 -47
- package/lib/runtime/graph.js +709 -89
- 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 +5 -3
- package/lib/stdlib/behavior/click-select.js +22 -7
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/collapse-expand-combo.d.ts +28 -0
- package/lib/stdlib/behavior/collapse-expand-combo.js +39 -0
- package/lib/stdlib/behavior/collapse-expand-combo.js.map +1 -0
- 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 +16 -11
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +111 -0
- package/lib/stdlib/behavior/drag-combo.js +384 -0
- package/lib/stdlib/behavior/drag-combo.js.map +1 -0
- package/lib/stdlib/behavior/drag-node.d.ts +33 -13
- package/lib/stdlib/behavior/drag-node.js +252 -66
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/hover-activate.d.ts +2 -1
- package/lib/stdlib/behavior/hover-activate.js +2 -0
- 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 +102 -0
- package/lib/stdlib/data/validateData.js.map +1 -0
- package/lib/stdlib/index.d.ts +115 -49
- package/lib/stdlib/index.js +190 -47
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/combo/circle.d.ts +29 -0
- package/lib/stdlib/item/combo/circle.js +60 -0
- package/lib/stdlib/item/combo/circle.js.map +1 -0
- 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 +12 -3
- package/lib/stdlib/item/edge/base.js +38 -4
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-horizontal.d.ts +36 -0
- package/lib/stdlib/item/edge/cubic-horizontal.js +60 -0
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -0
- package/lib/stdlib/item/edge/cubic-vertical.d.ts +36 -0
- package/lib/stdlib/item/edge/cubic-vertical.js +60 -0
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -0
- package/lib/stdlib/item/edge/cubic.d.ts +59 -0
- package/lib/stdlib/item/edge/cubic.js +120 -0
- package/lib/stdlib/item/edge/cubic.js.map +1 -0
- package/lib/stdlib/item/edge/index.d.ts +6 -0
- package/lib/stdlib/item/edge/index.js +6 -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 +40 -0
- package/lib/stdlib/item/edge/quadratic.js +82 -0
- package/lib/stdlib/item/edge/quadratic.js.map +1 -0
- package/lib/stdlib/item/node/base.d.ts +83 -38
- package/lib/stdlib/item/node/base.js +100 -15
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.js +1 -1
- 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 +8 -0
- package/lib/stdlib/item/node/index.js +8 -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 +32 -0
- package/lib/stdlib/item/node/rect.js +79 -0
- package/lib/stdlib/item/node/rect.js.map +1 -0
- 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 +130 -0
- package/lib/stdlib/plugin/fisheye/index.js +492 -0
- package/lib/stdlib/plugin/fisheye/index.js.map +1 -0
- 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 +46 -40
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/menu/index.d.ts +55 -0
- package/lib/stdlib/plugin/menu/index.js +244 -0
- package/lib/stdlib/plugin/menu/index.js.map +1 -0
- 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 +96 -0
- package/lib/stdlib/plugin/tooltip/index.js +385 -0
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -0
- 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 +14 -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 +66 -10
- 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 +51 -3
- package/lib/types/common.d.ts +10 -0
- package/lib/types/data.d.ts +13 -7
- package/lib/types/edge.d.ts +19 -5
- package/lib/types/event.d.ts +9 -1
- package/lib/types/event.js +10 -10
- package/lib/types/event.js.map +1 -1
- package/lib/types/graph.d.ts +169 -20
- 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 +33 -6
- package/lib/types/index.d.ts +11 -5
- package/lib/types/index.js.map +1 -1
- package/lib/types/item.d.ts +14 -8
- package/lib/types/item.js +1 -1
- 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 +90 -10
- package/lib/types/plugin.d.ts +4 -0
- package/lib/types/plugin.js.map +1 -1
- package/lib/types/spec.d.ts +26 -9
- 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 +11 -20
- package/lib/util/canvas.js.map +1 -1
- package/lib/util/data.d.ts +96 -0
- package/lib/util/data.js +276 -0
- package/lib/util/data.js.map +1 -0
- package/lib/util/event.d.ts +29 -1
- package/lib/util/event.js +73 -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 +2 -1
- package/lib/util/item.js +38 -13
- 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 +39 -4
- package/lib/util/shape.js +122 -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 +2 -2
- package/lib/util/zoom.js +6 -2
- package/lib/util/zoom.js.map +1 -1
- package/package.json +42 -22
- package/src/api-doc/behaviors.ts +2 -0
- package/src/api-doc/graph.ts +4 -0
- package/src/api-doc/item.ts +43 -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 +307 -2
- package/src/item/edge.ts +73 -24
- package/src/item/item.ts +184 -85
- package/src/item/node.ts +138 -69
- package/src/runtime/controller/data.ts +665 -191
- package/src/runtime/controller/interaction.ts +31 -7
- package/src/runtime/controller/item.ts +990 -172
- package/src/runtime/controller/layout.ts +165 -13
- package/src/runtime/controller/plugin.ts +47 -10
- package/src/runtime/controller/theme.ts +8 -4
- package/src/runtime/graph.ts +922 -144
- 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 +26 -11
- package/src/stdlib/behavior/collapse-expand-combo.ts +57 -0
- package/src/stdlib/behavior/collapse-expand-tree.ts +106 -0
- package/src/stdlib/behavior/drag-canvas.ts +15 -13
- package/src/stdlib/behavior/drag-combo.ts +589 -0
- package/src/stdlib/behavior/drag-node.ts +380 -110
- package/src/stdlib/behavior/hover-activate.ts +3 -5
- 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 +3 -5
- package/src/stdlib/behavior/rotate-canvas-3d.ts +1 -3
- package/src/stdlib/behavior/track-canvas-3d.ts +3 -5
- 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 +146 -0
- package/src/stdlib/index.ts +221 -37
- package/src/stdlib/item/combo/circle.ts +113 -0
- 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 +71 -6
- package/src/stdlib/item/edge/cubic-horizontal.ts +86 -0
- package/src/stdlib/item/edge/cubic-vertical.ts +85 -0
- package/src/stdlib/item/edge/cubic.ts +198 -0
- package/src/stdlib/item/edge/index.ts +6 -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 +133 -0
- package/src/stdlib/item/node/base.ts +195 -53
- package/src/stdlib/item/node/base3d.ts +2 -0
- 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 +8 -0
- package/src/stdlib/item/node/modelRect.ts +405 -0
- package/src/stdlib/item/node/rect.ts +141 -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 +607 -0
- 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 +122 -61
- package/src/stdlib/plugin/menu/index.ts +275 -0
- 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 +444 -0
- package/src/stdlib/plugin/types.ts +8 -0
- package/src/stdlib/theme/dark.ts +13 -1
- package/src/stdlib/theme/index.ts +2 -0
- package/src/stdlib/theme/light.ts +88 -10
- 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 +61 -4
- package/src/types/common.ts +13 -0
- package/src/types/data.ts +28 -7
- package/src/types/edge.ts +30 -6
- package/src/types/event.ts +8 -8
- package/src/types/graph.ts +232 -25
- package/src/types/history.ts +30 -0
- package/src/types/hook.ts +37 -7
- package/src/types/index.ts +37 -12
- package/src/types/item.ts +25 -11
- package/src/types/layout.ts +20 -16
- package/src/types/loop.ts +23 -0
- package/src/types/node.ts +94 -14
- package/src/types/plugin.ts +7 -1
- package/src/types/spec.ts +30 -13
- package/src/types/theme.ts +80 -10
- package/src/util/animate.ts +60 -20
- 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 +16 -24
- package/src/util/data.ts +307 -0
- package/src/util/event.ts +114 -1
- package/src/util/extend.ts +8 -2
- package/src/util/index.ts +31 -1
- package/src/util/item.ts +79 -13
- 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 +159 -6
- package/src/util/shape3d.ts +16 -11
- package/src/util/type.ts +8 -1
- package/src/util/zoom.ts +8 -4
- 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/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/src/stdlib/data/comboFromNode.ts +0 -28
|
@@ -0,0 +1,828 @@
|
|
|
1
|
+
import { AABB } from '@antv/g';
|
|
2
|
+
import { ComboModel, IGraph, NodeModel } from '../../../types';
|
|
3
|
+
import { Bounds, Point } from '../../../types/common';
|
|
4
|
+
import { isPointInPolygon } from '../../../util/shape';
|
|
5
|
+
import {
|
|
6
|
+
LineStructure,
|
|
7
|
+
pointLineSquareDist,
|
|
8
|
+
squareDist,
|
|
9
|
+
fractionToLine,
|
|
10
|
+
isPointsOverlap,
|
|
11
|
+
getPointsCenter,
|
|
12
|
+
itemIntersectByLine,
|
|
13
|
+
pointRectSquareDist,
|
|
14
|
+
} from './util';
|
|
15
|
+
import { BubblesetCfg } from './types';
|
|
16
|
+
|
|
17
|
+
const defaultOps = {
|
|
18
|
+
/** number of times to run the algorithm to refine the path finding in difficult areas */
|
|
19
|
+
maxRoutingIterations: 100,
|
|
20
|
+
/** number of times to refine the boundary */
|
|
21
|
+
maxMarchingIterations: 100,
|
|
22
|
+
/** the resolution of the algorithm in square pixels */
|
|
23
|
+
pixelGroupSize: 2,
|
|
24
|
+
/** the distance from edges at which energy is 1 (full influence) */
|
|
25
|
+
edgeR0: 10,
|
|
26
|
+
/** the distance from edges at which energy is 0 (no influence) */
|
|
27
|
+
edgeR1: 10,
|
|
28
|
+
/** the distance from nodes which energy is 1 (full influence) */
|
|
29
|
+
nodeR0: 5,
|
|
30
|
+
/** the distance from nodes at which energy is 0 (no influence) */
|
|
31
|
+
nodeR1: 10,
|
|
32
|
+
/** DEFAULT_NODE_R0; the amount of space to move the virtual edge when wrapping around obstacles */
|
|
33
|
+
morphBuffer: 5,
|
|
34
|
+
threshold: 0.001,
|
|
35
|
+
skip: 16,
|
|
36
|
+
nodeInfluenceFactor: 1,
|
|
37
|
+
edgeInfluenceFactor: 1,
|
|
38
|
+
negativeNodeInfluenceFactor: -0.5,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Marching square algorithm for traching the contour of a pixel group
|
|
43
|
+
* https://www.emanueleferonato.com/2013/03/01/using-marching-squares-algorithm-to-trace-the-contour-of-an-image/
|
|
44
|
+
* @param potentialArea
|
|
45
|
+
* @param threshold
|
|
46
|
+
*/
|
|
47
|
+
function MarchingSquares(contour, potentialArea, threshold) {
|
|
48
|
+
let marched = false;
|
|
49
|
+
const getVal = (x: number, y: number) => {
|
|
50
|
+
return potentialArea.cells[x + y * potentialArea.width];
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const getState = (x: number, y: number) => {
|
|
54
|
+
let squareVal = 0;
|
|
55
|
+
if (getVal(x - 1, y - 1) >= threshold) {
|
|
56
|
+
squareVal += 1;
|
|
57
|
+
}
|
|
58
|
+
if (getVal(x, y - 1) > threshold) {
|
|
59
|
+
squareVal += 2;
|
|
60
|
+
}
|
|
61
|
+
if (getVal(x - 1, y) > threshold) {
|
|
62
|
+
squareVal += 4;
|
|
63
|
+
}
|
|
64
|
+
if (getVal(x, y) > threshold) {
|
|
65
|
+
squareVal += 8;
|
|
66
|
+
}
|
|
67
|
+
return squareVal;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const doMarch = (xPos: number, yPos: number) => {
|
|
71
|
+
let x = xPos;
|
|
72
|
+
let y = yPos;
|
|
73
|
+
let prevX;
|
|
74
|
+
let prevY;
|
|
75
|
+
|
|
76
|
+
for (let i = 0; i < potentialArea.width * potentialArea.height; i++) {
|
|
77
|
+
prevX = x;
|
|
78
|
+
prevY = y;
|
|
79
|
+
if (contour.findIndex((item) => item.x === x && item.y === y) > -1) {
|
|
80
|
+
if (contour[0].x !== x || contour[0].y !== y) {
|
|
81
|
+
// encountered a loop but haven't returned to start: change direction using conditionals and continue back to start
|
|
82
|
+
} else {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
contour.push({ x, y });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const state = getState(x, y);
|
|
90
|
+
// assign the move direction according to state of the square
|
|
91
|
+
switch (state) {
|
|
92
|
+
case -1:
|
|
93
|
+
console.warn('Marched out of bounds');
|
|
94
|
+
return true;
|
|
95
|
+
case 0:
|
|
96
|
+
case 3:
|
|
97
|
+
case 2:
|
|
98
|
+
case 7:
|
|
99
|
+
x++; // go right
|
|
100
|
+
break;
|
|
101
|
+
case 12:
|
|
102
|
+
case 14:
|
|
103
|
+
case 4:
|
|
104
|
+
x--; // go left
|
|
105
|
+
break;
|
|
106
|
+
case 6: // go left if come from up else go right
|
|
107
|
+
if (prevX === 0) {
|
|
108
|
+
if (prevY === -1) {
|
|
109
|
+
x -= 1;
|
|
110
|
+
} else {
|
|
111
|
+
x += 1;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case 1:
|
|
116
|
+
case 13:
|
|
117
|
+
case 5:
|
|
118
|
+
y--; // go up
|
|
119
|
+
break;
|
|
120
|
+
case 9: // go up if come from right else go down
|
|
121
|
+
if (prevX === 1) {
|
|
122
|
+
if (prevY === 0) {
|
|
123
|
+
y -= 1;
|
|
124
|
+
} else {
|
|
125
|
+
y += 1;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
129
|
+
case 10:
|
|
130
|
+
case 8:
|
|
131
|
+
case 11:
|
|
132
|
+
y++; // go down
|
|
133
|
+
break;
|
|
134
|
+
default:
|
|
135
|
+
console.warn(`Marching squares invalid state: ${state}`);
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
this.march = () => {
|
|
142
|
+
for (let x = 0; x < potentialArea.width && !marched; x += 1) {
|
|
143
|
+
for (let y = 0; y < potentialArea.height && !marched; y += 1) {
|
|
144
|
+
if (getVal(x, y) > threshold && getState(x, y) !== 15) {
|
|
145
|
+
marched = doMarch(x, y);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return marched;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Space partition & assign value to each cell
|
|
155
|
+
* @param points
|
|
156
|
+
*/
|
|
157
|
+
const initGridCells = (
|
|
158
|
+
width: number,
|
|
159
|
+
height: number,
|
|
160
|
+
pixelGroupSize: number,
|
|
161
|
+
) => {
|
|
162
|
+
const scaleWidth = Math.ceil(width / pixelGroupSize);
|
|
163
|
+
const scaleHeight = Math.ceil(height / pixelGroupSize);
|
|
164
|
+
const gridCells = new Float32Array(
|
|
165
|
+
Math.max(0, scaleWidth * scaleHeight),
|
|
166
|
+
).fill(0);
|
|
167
|
+
return {
|
|
168
|
+
cells: gridCells,
|
|
169
|
+
width: scaleWidth,
|
|
170
|
+
height: scaleHeight,
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Find the optimal already visited member to item;
|
|
176
|
+
Optimal: minimize cost(j) = distance(i,j) ∗ countObstacles(i,j)
|
|
177
|
+
* @param item
|
|
178
|
+
* @param visited
|
|
179
|
+
*/
|
|
180
|
+
const pickBestNeighbor = (
|
|
181
|
+
graph: IGraph,
|
|
182
|
+
model: NodeModel | ComboModel,
|
|
183
|
+
visited: (NodeModel | ComboModel)[],
|
|
184
|
+
nonMembers: (NodeModel | ComboModel)[],
|
|
185
|
+
): NodeModel | ComboModel | null => {
|
|
186
|
+
let closestNeighbour = null;
|
|
187
|
+
let minCost = Number.POSITIVE_INFINITY;
|
|
188
|
+
|
|
189
|
+
visited.forEach((neighborModel) => {
|
|
190
|
+
const itemP = { x: model.data.x, y: model.data.y } as Point;
|
|
191
|
+
const neighbourItemP = {
|
|
192
|
+
x: neighborModel.data.x,
|
|
193
|
+
y: neighborModel.data.y,
|
|
194
|
+
} as Point;
|
|
195
|
+
const dist = squareDist(itemP, neighbourItemP);
|
|
196
|
+
const directLine = new LineStructure(
|
|
197
|
+
itemP.x,
|
|
198
|
+
itemP.y,
|
|
199
|
+
neighbourItemP.x,
|
|
200
|
+
neighbourItemP.y,
|
|
201
|
+
);
|
|
202
|
+
const numberObstacles = nonMembers.reduce((count, _item) => {
|
|
203
|
+
if (fractionToLine(graph, _item.id, directLine) > 0) {
|
|
204
|
+
return count + 1;
|
|
205
|
+
}
|
|
206
|
+
return count;
|
|
207
|
+
}, 0);
|
|
208
|
+
if (dist * (numberObstacles + 1) ** 2 < minCost) {
|
|
209
|
+
closestNeighbour = neighborModel;
|
|
210
|
+
minCost = dist * (numberObstacles + 1) ** 2;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
return closestNeighbour;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* 返回和线相交的item中,离边的起点最近的item
|
|
218
|
+
* @param items
|
|
219
|
+
* @param line
|
|
220
|
+
*/
|
|
221
|
+
const getIntersectItem = (
|
|
222
|
+
graph: IGraph,
|
|
223
|
+
items: (NodeModel | ComboModel)[],
|
|
224
|
+
line: LineStructure,
|
|
225
|
+
): NodeModel | ComboModel | null => {
|
|
226
|
+
let minDistance = Number.POSITIVE_INFINITY;
|
|
227
|
+
let closestItem = null;
|
|
228
|
+
|
|
229
|
+
items.forEach((item) => {
|
|
230
|
+
const distance = fractionToLine(graph, item.id, line);
|
|
231
|
+
// find closest intersection
|
|
232
|
+
if (distance >= 0 && distance < minDistance) {
|
|
233
|
+
closestItem = item;
|
|
234
|
+
minDistance = distance;
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
return closestItem;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Modify the directLine and Route virtual edges around obstacles
|
|
242
|
+
*/
|
|
243
|
+
const computeRoute = (
|
|
244
|
+
graph: IGraph,
|
|
245
|
+
directLine: LineStructure,
|
|
246
|
+
nonMembers: (NodeModel | ComboModel)[],
|
|
247
|
+
maxRoutingIterations: number,
|
|
248
|
+
morphBuffer: number,
|
|
249
|
+
): LineStructure[] => {
|
|
250
|
+
const checkedLines: LineStructure[] = [];
|
|
251
|
+
const linesToCheck: LineStructure[] = [];
|
|
252
|
+
linesToCheck.push(directLine);
|
|
253
|
+
|
|
254
|
+
let hasIntersection = true;
|
|
255
|
+
let iterations = 0;
|
|
256
|
+
|
|
257
|
+
const pointExists = (point: Point, lines: LineStructure[]) => {
|
|
258
|
+
let flag = false;
|
|
259
|
+
lines.forEach((line) => {
|
|
260
|
+
if (flag) return;
|
|
261
|
+
if (
|
|
262
|
+
isPointsOverlap(point, { x: line.x1, y: line.y1 }) ||
|
|
263
|
+
isPointsOverlap(point, { x: line.x2, y: line.y2 })
|
|
264
|
+
) {
|
|
265
|
+
flag = true;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
return flag;
|
|
269
|
+
};
|
|
270
|
+
const isPointInNonMembers = (
|
|
271
|
+
graph: IGraph,
|
|
272
|
+
point: Point,
|
|
273
|
+
_nonMembers: (NodeModel | ComboModel)[],
|
|
274
|
+
) => {
|
|
275
|
+
for (const model of _nonMembers) {
|
|
276
|
+
const bbox = graph.getRenderBBox(model.id);
|
|
277
|
+
if (!bbox) continue;
|
|
278
|
+
const [x, y] = bbox.min;
|
|
279
|
+
const itemContour = [
|
|
280
|
+
[x, y],
|
|
281
|
+
[bbox.max[0], y],
|
|
282
|
+
[x, bbox.max[1]],
|
|
283
|
+
[bbox.max[0], bbox.max[1]],
|
|
284
|
+
];
|
|
285
|
+
if (isPointInPolygon(itemContour, point.x, point.y)) {
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return false;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// outer loop end when no more intersections or out of iterations
|
|
293
|
+
while (hasIntersection && iterations < maxRoutingIterations) {
|
|
294
|
+
hasIntersection = false;
|
|
295
|
+
// inner loop end when out of lines or found an intersection
|
|
296
|
+
while (!hasIntersection && linesToCheck.length) {
|
|
297
|
+
const line = linesToCheck.pop();
|
|
298
|
+
const closestItem = getIntersectItem(graph, nonMembers, line);
|
|
299
|
+
if (closestItem) {
|
|
300
|
+
const [intersections, countIntersections] = itemIntersectByLine(
|
|
301
|
+
graph,
|
|
302
|
+
closestItem.id,
|
|
303
|
+
line,
|
|
304
|
+
);
|
|
305
|
+
// if line passes through item
|
|
306
|
+
if (countIntersections === 2) {
|
|
307
|
+
const testReroute = (isFirst: boolean) => {
|
|
308
|
+
let tempMorphBuffer = morphBuffer;
|
|
309
|
+
let virtualNode = rerouteLine(
|
|
310
|
+
closestItem,
|
|
311
|
+
tempMorphBuffer,
|
|
312
|
+
intersections,
|
|
313
|
+
isFirst,
|
|
314
|
+
);
|
|
315
|
+
// test the virtualNode already exists
|
|
316
|
+
let exist =
|
|
317
|
+
pointExists(virtualNode, linesToCheck) ||
|
|
318
|
+
pointExists(virtualNode, checkedLines);
|
|
319
|
+
let pointInside = isPointInNonMembers(
|
|
320
|
+
graph,
|
|
321
|
+
virtualNode,
|
|
322
|
+
nonMembers,
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
while (!exist && pointInside && tempMorphBuffer >= 1) {
|
|
326
|
+
// try a smaller buffer
|
|
327
|
+
tempMorphBuffer /= 1.5;
|
|
328
|
+
virtualNode = rerouteLine(
|
|
329
|
+
closestItem,
|
|
330
|
+
tempMorphBuffer,
|
|
331
|
+
intersections,
|
|
332
|
+
isFirst,
|
|
333
|
+
);
|
|
334
|
+
exist =
|
|
335
|
+
pointExists(virtualNode, linesToCheck) ||
|
|
336
|
+
pointExists(virtualNode, checkedLines);
|
|
337
|
+
pointInside = isPointInNonMembers(graph, virtualNode, nonMembers);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// 第二次route时不要求pointInside
|
|
341
|
+
if (virtualNode && !exist && (!isFirst || !pointInside)) {
|
|
342
|
+
// add 2 rerouted lines to check
|
|
343
|
+
linesToCheck.push(
|
|
344
|
+
new LineStructure(
|
|
345
|
+
line.x1,
|
|
346
|
+
line.y1,
|
|
347
|
+
virtualNode.x,
|
|
348
|
+
virtualNode.y,
|
|
349
|
+
),
|
|
350
|
+
);
|
|
351
|
+
linesToCheck.push(
|
|
352
|
+
new LineStructure(
|
|
353
|
+
virtualNode.x,
|
|
354
|
+
virtualNode.y,
|
|
355
|
+
line.x2,
|
|
356
|
+
line.y2,
|
|
357
|
+
),
|
|
358
|
+
);
|
|
359
|
+
hasIntersection = true;
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
testReroute(true);
|
|
364
|
+
if (!hasIntersection) {
|
|
365
|
+
// if we didn't find a valid point around the first corner, try the second
|
|
366
|
+
testReroute(false);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// no intersection found, mark this line as completed
|
|
372
|
+
if (!hasIntersection) {
|
|
373
|
+
checkedLines.push(line);
|
|
374
|
+
}
|
|
375
|
+
iterations += 1;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// 加入剩余的线
|
|
380
|
+
while (linesToCheck.length) {
|
|
381
|
+
checkedLines.push(linesToCheck.pop());
|
|
382
|
+
}
|
|
383
|
+
return checkedLines;
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Connect item with visited members using direct line or virtual edges
|
|
388
|
+
*/
|
|
389
|
+
function getRoute(
|
|
390
|
+
graph: IGraph,
|
|
391
|
+
currentModel: NodeModel | ComboModel,
|
|
392
|
+
nonMembers: (NodeModel | ComboModel)[],
|
|
393
|
+
visited: (NodeModel | ComboModel)[],
|
|
394
|
+
maxRoutingIterations: number,
|
|
395
|
+
morphBuffer: number,
|
|
396
|
+
) {
|
|
397
|
+
const optimalNeighbor = pickBestNeighbor(
|
|
398
|
+
graph,
|
|
399
|
+
currentModel,
|
|
400
|
+
visited,
|
|
401
|
+
nonMembers,
|
|
402
|
+
);
|
|
403
|
+
if (optimalNeighbor === null) {
|
|
404
|
+
return [];
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// merge the consecutive lines
|
|
408
|
+
const mergeLines = (checkedLines: LineStructure[]): LineStructure[] => {
|
|
409
|
+
const finalRoute: LineStructure[] = [];
|
|
410
|
+
while (checkedLines.length > 0) {
|
|
411
|
+
const line1 = checkedLines.pop()!;
|
|
412
|
+
if (checkedLines.length === 0) {
|
|
413
|
+
finalRoute.push(line1);
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
const line2 = checkedLines.pop()!;
|
|
417
|
+
const mergeLine = new LineStructure(
|
|
418
|
+
line1.x1,
|
|
419
|
+
line1.y1,
|
|
420
|
+
line2.x2,
|
|
421
|
+
line2.y2,
|
|
422
|
+
);
|
|
423
|
+
const closestItem = getIntersectItem(graph, nonMembers, mergeLine);
|
|
424
|
+
// merge most recent line and previous line
|
|
425
|
+
if (!closestItem) {
|
|
426
|
+
checkedLines.push(mergeLine);
|
|
427
|
+
} else {
|
|
428
|
+
finalRoute.push(line1);
|
|
429
|
+
checkedLines.push(line2);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return finalRoute;
|
|
433
|
+
};
|
|
434
|
+
const directLine = new LineStructure(
|
|
435
|
+
currentModel.data.x as number,
|
|
436
|
+
currentModel.data.y as number,
|
|
437
|
+
optimalNeighbor.data.x as number,
|
|
438
|
+
optimalNeighbor.data.y as number,
|
|
439
|
+
);
|
|
440
|
+
const checkedLines = computeRoute(
|
|
441
|
+
graph,
|
|
442
|
+
directLine,
|
|
443
|
+
nonMembers,
|
|
444
|
+
maxRoutingIterations,
|
|
445
|
+
morphBuffer,
|
|
446
|
+
);
|
|
447
|
+
const finalRoute = mergeLines(checkedLines);
|
|
448
|
+
return finalRoute;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Calculate the countor that includes the selected items and exclues the non-selected items
|
|
453
|
+
* @param members
|
|
454
|
+
* @param nonMembers
|
|
455
|
+
* @param options
|
|
456
|
+
*/
|
|
457
|
+
export const genBubbleSet = (
|
|
458
|
+
graph: IGraph,
|
|
459
|
+
members: (NodeModel | ComboModel)[],
|
|
460
|
+
nonMembers: (NodeModel | ComboModel)[],
|
|
461
|
+
ops?: BubblesetCfg,
|
|
462
|
+
) => {
|
|
463
|
+
// eslint-disable-next-line no-redeclare
|
|
464
|
+
const options = Object.assign(defaultOps, ops);
|
|
465
|
+
const centroid = getPointsCenter(
|
|
466
|
+
members.map((model) => ({ x: model.data.x, y: model.data.y } as Point)),
|
|
467
|
+
);
|
|
468
|
+
// 按照到中心距离远近排序
|
|
469
|
+
members = members.sort(
|
|
470
|
+
(a, b) =>
|
|
471
|
+
squareDist({ x: a.data.x, y: a.data.y } as Point, centroid) -
|
|
472
|
+
squareDist({ x: b.data.x, y: b.data.y } as Point, centroid),
|
|
473
|
+
);
|
|
474
|
+
const visited: (NodeModel | ComboModel)[] = [];
|
|
475
|
+
const virtualEdges: LineStructure[] = [];
|
|
476
|
+
members.forEach((model) => {
|
|
477
|
+
const lines = getRoute(
|
|
478
|
+
graph,
|
|
479
|
+
model,
|
|
480
|
+
nonMembers,
|
|
481
|
+
visited,
|
|
482
|
+
options.maxRoutingIterations,
|
|
483
|
+
options.morphBuffer,
|
|
484
|
+
);
|
|
485
|
+
lines.forEach((l) => {
|
|
486
|
+
virtualEdges.push(l);
|
|
487
|
+
});
|
|
488
|
+
visited.push(model);
|
|
489
|
+
});
|
|
490
|
+
// 由于edge也可以作为member和nonMember传入,暂时不考虑把edges作为参数传入genBubbleSet
|
|
491
|
+
// edges && edges.forEach(e => {
|
|
492
|
+
// virtualEdges.push(new LineStructure(e.getSource().getModel().x, e.getSource().getModel().y, e.getTarget().getModel().x, e.getTarget().getModel().y));
|
|
493
|
+
// });
|
|
494
|
+
|
|
495
|
+
const activeRegion = getActiveRregion(
|
|
496
|
+
graph,
|
|
497
|
+
members,
|
|
498
|
+
virtualEdges,
|
|
499
|
+
options.nodeR0,
|
|
500
|
+
);
|
|
501
|
+
const potentialArea = initGridCells(
|
|
502
|
+
activeRegion.max[0] - activeRegion.min[0],
|
|
503
|
+
activeRegion.max[1] - activeRegion.min[1],
|
|
504
|
+
options.pixelGroupSize,
|
|
505
|
+
);
|
|
506
|
+
|
|
507
|
+
// Use march squares to generate contour
|
|
508
|
+
let contour = [];
|
|
509
|
+
let hull = [];
|
|
510
|
+
for (
|
|
511
|
+
let iterations = 0;
|
|
512
|
+
iterations < options.maxMarchingIterations;
|
|
513
|
+
iterations++
|
|
514
|
+
) {
|
|
515
|
+
fillPotentialArea(
|
|
516
|
+
graph,
|
|
517
|
+
members,
|
|
518
|
+
nonMembers,
|
|
519
|
+
virtualEdges,
|
|
520
|
+
activeRegion,
|
|
521
|
+
potentialArea,
|
|
522
|
+
options,
|
|
523
|
+
);
|
|
524
|
+
contour = [];
|
|
525
|
+
hull = [];
|
|
526
|
+
if (!new MarchingSquares(contour, potentialArea, options.threshold).march())
|
|
527
|
+
continue;
|
|
528
|
+
const marchedPath = contour.map((point) => ({
|
|
529
|
+
x: Math.round(point.x * options.pixelGroupSize + activeRegion.min[0]),
|
|
530
|
+
y: Math.round(point.y * options.pixelGroupSize + activeRegion.min[1]),
|
|
531
|
+
}));
|
|
532
|
+
// const marchedPath = marchingSquares(potentialArea, options.threshold).map(point => ({ x: Math.round(point.x * options.pixelGroupSize + activeRegion.minX), y: Math.round(point.y * options.pixelGroupSize + activeRegion.minY) }))
|
|
533
|
+
if (marchedPath) {
|
|
534
|
+
let size = marchedPath.length;
|
|
535
|
+
if (options.skip > 1) {
|
|
536
|
+
size = Math.floor(marchedPath.length / options.skip);
|
|
537
|
+
// if we reduced too much (fewer than three points in reduced surface) reduce skip and try again
|
|
538
|
+
while (size < 3 && options.skip > 1) {
|
|
539
|
+
options.skip -= 1;
|
|
540
|
+
size = Math.floor(marchedPath.length / options.skip);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
// copy hull values
|
|
544
|
+
for (let i = 0, j = 0; j < size; j += 1, i += options.skip) {
|
|
545
|
+
hull.push({ x: marchedPath[i].x, y: marchedPath[i].y });
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
const isContourValid = () => {
|
|
550
|
+
for (const model of members) {
|
|
551
|
+
const hullPoints = hull.map((point) => [point.x, point.y]);
|
|
552
|
+
const nodeBBox = graph.getRenderBBox(model.id);
|
|
553
|
+
if (!nodeBBox) continue;
|
|
554
|
+
if (
|
|
555
|
+
!isPointInPolygon(hullPoints, nodeBBox.center[0], nodeBBox.center[1])
|
|
556
|
+
)
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
// 不强制要求所有nonMembers都没有包含在内
|
|
560
|
+
// for (const item of nonMembers) {
|
|
561
|
+
// if (isPointInPolygon({ x: item.getBBox().centerX, y: item.getBBox().centerY }, contour)) return false
|
|
562
|
+
// }
|
|
563
|
+
return true;
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
if (hull && isContourValid()) {
|
|
567
|
+
return hull;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// update parameters for next iteraction
|
|
571
|
+
options.threshold *= 0.9;
|
|
572
|
+
if (iterations <= options.maxMarchingIterations * 0.5) {
|
|
573
|
+
options.memberInfluenceFactor *= 1.2;
|
|
574
|
+
options.edgeInfluenceFactor *= 1.2;
|
|
575
|
+
} else if (
|
|
576
|
+
options.nonMemberInfluenceFactor !== 0 &&
|
|
577
|
+
nonMembers.length > 0
|
|
578
|
+
) {
|
|
579
|
+
// after half the iterations, start increasing positive energy and lowering the threshold
|
|
580
|
+
options.nonMemberInfluenceFactor *= 0.8;
|
|
581
|
+
} else {
|
|
582
|
+
break;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return hull;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* unionboundingbox
|
|
590
|
+
* @param members
|
|
591
|
+
* @param edges
|
|
592
|
+
*/
|
|
593
|
+
function getActiveRregion(
|
|
594
|
+
graph: IGraph,
|
|
595
|
+
members: (NodeModel | ComboModel)[],
|
|
596
|
+
edges: LineStructure[],
|
|
597
|
+
offset: number,
|
|
598
|
+
): AABB {
|
|
599
|
+
const activeRegion = {
|
|
600
|
+
min: [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, 0],
|
|
601
|
+
max: [Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY, 0],
|
|
602
|
+
halfExtents: [0, 0, 0],
|
|
603
|
+
} as AABB;
|
|
604
|
+
const bboxes = [];
|
|
605
|
+
|
|
606
|
+
members.forEach((model) => {
|
|
607
|
+
bboxes.push(graph.getRenderBBox(model.id));
|
|
608
|
+
});
|
|
609
|
+
edges.forEach((l) => {
|
|
610
|
+
bboxes.push(l.getBBox());
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
for (const bbox of bboxes) {
|
|
614
|
+
activeRegion.min[0] =
|
|
615
|
+
(bbox.min[0] < activeRegion.min[0] ? bbox.min[0] : activeRegion.min[0]) -
|
|
616
|
+
offset;
|
|
617
|
+
activeRegion.min[1] =
|
|
618
|
+
(bbox.min[1] < activeRegion.min[1] ? bbox.min[1] : activeRegion.min[1]) -
|
|
619
|
+
offset;
|
|
620
|
+
activeRegion.max[0] =
|
|
621
|
+
(bbox.max[0] > activeRegion.max[0] ? bbox.max[0] : activeRegion.max[0]) +
|
|
622
|
+
offset;
|
|
623
|
+
activeRegion.max[1] =
|
|
624
|
+
(bbox.max[1] > activeRegion.max[1] ? bbox.max[1] : activeRegion.max[1]) +
|
|
625
|
+
offset;
|
|
626
|
+
}
|
|
627
|
+
activeRegion.halfExtents = [
|
|
628
|
+
(activeRegion.max[0] - activeRegion.min[0]) / 2,
|
|
629
|
+
(activeRegion.max[1] - activeRegion.min[1]) / 2,
|
|
630
|
+
0,
|
|
631
|
+
];
|
|
632
|
+
return activeRegion;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
function fillPotentialArea(
|
|
636
|
+
graph: IGraph,
|
|
637
|
+
members: (NodeModel | ComboModel)[],
|
|
638
|
+
nonMembers: (NodeModel | ComboModel)[],
|
|
639
|
+
edges: LineStructure[],
|
|
640
|
+
activeRegion: AABB,
|
|
641
|
+
potentialArea,
|
|
642
|
+
options: BubblesetCfg,
|
|
643
|
+
) {
|
|
644
|
+
function pos2GridIx(x, offset) {
|
|
645
|
+
const gridIx = Math.floor((x - offset) / options.pixelGroupSize);
|
|
646
|
+
return gridIx < 0 ? 0 : gridIx;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
function gridIx2Pos(x, offset) {
|
|
650
|
+
return x * options.pixelGroupSize + offset;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// using inverse a for numerical stability
|
|
654
|
+
const nodeInfA =
|
|
655
|
+
(options.nodeR0 - options.nodeR1) * (options.nodeR0 - options.nodeR1);
|
|
656
|
+
const edgeInfA =
|
|
657
|
+
(options.edgeR0 - options.edgeR1) * (options.edgeR0 - options.edgeR1);
|
|
658
|
+
|
|
659
|
+
const getAffectedRegion = (bbox: Bounds, thresholdR) => {
|
|
660
|
+
const startX = Math.min(
|
|
661
|
+
pos2GridIx(bbox.min[0], thresholdR + activeRegion.min[0]),
|
|
662
|
+
potentialArea.width,
|
|
663
|
+
);
|
|
664
|
+
const startY = Math.min(
|
|
665
|
+
pos2GridIx(bbox.min[1], thresholdR + activeRegion.min[1]),
|
|
666
|
+
potentialArea.height,
|
|
667
|
+
);
|
|
668
|
+
const endX = Math.min(
|
|
669
|
+
pos2GridIx(bbox.max[0], -thresholdR + activeRegion.min[0]),
|
|
670
|
+
potentialArea.width,
|
|
671
|
+
);
|
|
672
|
+
const endY = Math.min(
|
|
673
|
+
pos2GridIx(bbox.max[1], -thresholdR + activeRegion.min[1]),
|
|
674
|
+
potentialArea.height,
|
|
675
|
+
);
|
|
676
|
+
return [startX, startY, endX, endY];
|
|
677
|
+
};
|
|
678
|
+
const addItemInfluence = (
|
|
679
|
+
graph: IGraph,
|
|
680
|
+
model: NodeModel | ComboModel,
|
|
681
|
+
influenceFactor: number,
|
|
682
|
+
) => {
|
|
683
|
+
const bbox = graph.getRenderBBox(model.id);
|
|
684
|
+
if (!bbox) return;
|
|
685
|
+
const [startX, startY, endX, endY] = getAffectedRegion(
|
|
686
|
+
bbox,
|
|
687
|
+
options.nodeR1,
|
|
688
|
+
);
|
|
689
|
+
// calculate item influence for each cell
|
|
690
|
+
for (let y = startY; y < endY; y += 1) {
|
|
691
|
+
for (let x = startX; x < endX; x += 1) {
|
|
692
|
+
if (
|
|
693
|
+
influenceFactor < 0 &&
|
|
694
|
+
potentialArea[x + y * potentialArea.width] <= 0
|
|
695
|
+
) {
|
|
696
|
+
continue;
|
|
697
|
+
}
|
|
698
|
+
const tempX = gridIx2Pos(x, activeRegion.min[0]);
|
|
699
|
+
const tempY = gridIx2Pos(y, activeRegion.min[1]);
|
|
700
|
+
const distanceSq = pointRectSquareDist(
|
|
701
|
+
{ x: tempX, y: tempY },
|
|
702
|
+
{
|
|
703
|
+
x: bbox.min[0],
|
|
704
|
+
y: bbox.min[1],
|
|
705
|
+
width: bbox.max[0] - bbox.min[0],
|
|
706
|
+
height: bbox.max[1] - bbox.min[1],
|
|
707
|
+
},
|
|
708
|
+
);
|
|
709
|
+
if (distanceSq < options.nodeR1 ** 2) {
|
|
710
|
+
const dr = Math.sqrt(distanceSq) - options.nodeR1;
|
|
711
|
+
potentialArea.cells[x + y * potentialArea.width] +=
|
|
712
|
+
influenceFactor * dr * dr;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
const addEdgeInfluence = (line: LineStructure, influenceFactor: number) => {
|
|
719
|
+
const bbox = line.getBBox();
|
|
720
|
+
const [startX, startY, endX, endY] = getAffectedRegion(
|
|
721
|
+
bbox,
|
|
722
|
+
options.edgeR1,
|
|
723
|
+
);
|
|
724
|
+
// for every point in active part of potentialArea, calculate distance to nearest point on line and add influence
|
|
725
|
+
for (let y = startY; y < endY; y += 1) {
|
|
726
|
+
for (let x = startX; x < endX; x += 1) {
|
|
727
|
+
if (
|
|
728
|
+
influenceFactor < 0 &&
|
|
729
|
+
potentialArea.cells[x + y * potentialArea.width] <= 0
|
|
730
|
+
) {
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
const tempX = gridIx2Pos(x, activeRegion.min[0]);
|
|
734
|
+
const tempY = gridIx2Pos(y, activeRegion.min[1]);
|
|
735
|
+
const minDistanceSq = pointLineSquareDist({ x: tempX, y: tempY }, line);
|
|
736
|
+
// only influence if less than r1
|
|
737
|
+
if (minDistanceSq < options.edgeR1 ** 2) {
|
|
738
|
+
const mdr = Math.sqrt(minDistanceSq) - options.edgeR1;
|
|
739
|
+
potentialArea.cells[x + y * potentialArea.width] +=
|
|
740
|
+
influenceFactor * mdr * mdr;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
if (options.nodeInfluenceFactor) {
|
|
747
|
+
members.forEach((item) => {
|
|
748
|
+
addItemInfluence(graph, item, options.nodeInfluenceFactor / nodeInfA);
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
if (options.edgeInfluenceFactor) {
|
|
753
|
+
edges.forEach((edge) => {
|
|
754
|
+
addEdgeInfluence(edge, options.edgeInfluenceFactor / edgeInfA);
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
if (options.negativeNodeInfluenceFactor) {
|
|
758
|
+
nonMembers.forEach((item) => {
|
|
759
|
+
addItemInfluence(
|
|
760
|
+
graph,
|
|
761
|
+
item,
|
|
762
|
+
options.negativeNodeInfluenceFactor / nodeInfA,
|
|
763
|
+
);
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
function rerouteLine(
|
|
769
|
+
item,
|
|
770
|
+
buffer: number,
|
|
771
|
+
intersections: Point[],
|
|
772
|
+
wrapNormal: boolean,
|
|
773
|
+
): Point {
|
|
774
|
+
const bbox = item.getBBox();
|
|
775
|
+
const [topIntersect, leftIntersect, bottomIntersect, rightIntersect] =
|
|
776
|
+
intersections;
|
|
777
|
+
const cornerPos = {
|
|
778
|
+
topLeft: { x: bbox.minX - buffer, y: bbox.minY - buffer },
|
|
779
|
+
topRight: { x: bbox.maxX + buffer, y: bbox.minY - buffer },
|
|
780
|
+
bottomLeft: { x: bbox.minX - buffer, y: bbox.maxY + buffer },
|
|
781
|
+
bottomRight: { x: bbox.maxX + buffer, y: bbox.maxY + buffer },
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
const totalArea = bbox.height * bbox.width;
|
|
785
|
+
function calcHalfArea(intersect1, intersect2) {
|
|
786
|
+
return (
|
|
787
|
+
bbox.width *
|
|
788
|
+
((intersect1.y - bbox.minY + (intersect2.y - bbox.minY)) * 0.5)
|
|
789
|
+
);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// Find the position of the control point according to the intersect of line and boundinb box
|
|
793
|
+
if (leftIntersect) {
|
|
794
|
+
// If there is a triangle in the intersect area
|
|
795
|
+
if (topIntersect)
|
|
796
|
+
return wrapNormal ? cornerPos.topLeft : cornerPos.bottomRight;
|
|
797
|
+
if (bottomIntersect)
|
|
798
|
+
return wrapNormal ? cornerPos.bottomLeft : cornerPos.topRight;
|
|
799
|
+
// Divide the intersect area into two trapezoids upper and down, compare the area
|
|
800
|
+
const topArea = calcHalfArea(leftIntersect, rightIntersect);
|
|
801
|
+
if (topArea < totalArea * 0.5) {
|
|
802
|
+
if (leftIntersect.y > rightIntersect.y)
|
|
803
|
+
return wrapNormal ? cornerPos.topLeft : cornerPos.bottomRight;
|
|
804
|
+
return wrapNormal ? cornerPos.topRight : cornerPos.bottomLeft;
|
|
805
|
+
}
|
|
806
|
+
if (leftIntersect.y < rightIntersect.y)
|
|
807
|
+
return wrapNormal ? cornerPos.bottomLeft : cornerPos.topRight;
|
|
808
|
+
return wrapNormal ? cornerPos.bottomRight : cornerPos.topLeft;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
if (rightIntersect) {
|
|
812
|
+
if (topIntersect)
|
|
813
|
+
return wrapNormal ? cornerPos.topRight : cornerPos.bottomLeft;
|
|
814
|
+
if (bottomIntersect)
|
|
815
|
+
return wrapNormal ? cornerPos.bottomRight : cornerPos.topLeft;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
// Divide the intersect area into two trapezoids left and right
|
|
819
|
+
const leftArea = calcHalfArea(topIntersect, bottomIntersect);
|
|
820
|
+
if (leftArea < totalArea * 0.5) {
|
|
821
|
+
if (topIntersect.x > bottomIntersect.x)
|
|
822
|
+
return wrapNormal ? cornerPos.topLeft : cornerPos.bottomRight;
|
|
823
|
+
return wrapNormal ? cornerPos.bottomLeft : cornerPos.topRight;
|
|
824
|
+
}
|
|
825
|
+
if (topIntersect.x < bottomIntersect.x)
|
|
826
|
+
return wrapNormal ? cornerPos.topRight : cornerPos.bottomLeft;
|
|
827
|
+
return wrapNormal ? cornerPos.bottomRight : cornerPos.topLeft;
|
|
828
|
+
}
|