@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,161 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { isArray, throttle, uniqueId } from '@antv/util';
|
|
13
|
+
import { Plugin as Base } from '../../../types/plugin';
|
|
14
|
+
import { isArrayOverlap } from '../../../util/array';
|
|
15
|
+
import { DEFAULT_TEXT_STYLE } from '../../../constant';
|
|
16
|
+
import HullComponent from './hullComponent';
|
|
17
|
+
export default class Hull extends Base {
|
|
18
|
+
constructor(options) {
|
|
19
|
+
super(options);
|
|
20
|
+
this.hullMap = {};
|
|
21
|
+
this.cacheChanges = {
|
|
22
|
+
remove: [],
|
|
23
|
+
update: [],
|
|
24
|
+
};
|
|
25
|
+
this.debounceUpdateMembers = throttle(() => {
|
|
26
|
+
Object.keys(this.hullMap).forEach((id) => {
|
|
27
|
+
const hullComponent = this.hullMap[id];
|
|
28
|
+
if (this.cacheChanges.remove.length) {
|
|
29
|
+
isArrayOverlap(hullComponent.options.members, this.cacheChanges.remove) && hullComponent.removeMember(this.cacheChanges.remove);
|
|
30
|
+
}
|
|
31
|
+
else if (this.cacheChanges.update.length) {
|
|
32
|
+
const modelIds = this.cacheChanges.update.map((model) => model.id);
|
|
33
|
+
isArrayOverlap(hullComponent.options.members, modelIds) &&
|
|
34
|
+
hullComponent.updateMembers();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
this.cacheChanges = { update: [], remove: [] };
|
|
38
|
+
}, 50, {
|
|
39
|
+
trailing: true,
|
|
40
|
+
leading: true,
|
|
41
|
+
});
|
|
42
|
+
this.key = (options === null || options === void 0 ? void 0 : options.key) || `hull-${Math.random()}`;
|
|
43
|
+
}
|
|
44
|
+
getDefaultCfgs() {
|
|
45
|
+
return {
|
|
46
|
+
key: `hull-${uniqueId()}`,
|
|
47
|
+
padding: 10,
|
|
48
|
+
style: {
|
|
49
|
+
fill: 'lightblue',
|
|
50
|
+
stroke: 'blue',
|
|
51
|
+
opacity: 0.2,
|
|
52
|
+
},
|
|
53
|
+
labelShape: Object.assign(Object.assign({}, DEFAULT_TEXT_STYLE), { position: 'outside-top', offsetY: -2 }),
|
|
54
|
+
hulls: [],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
init(graph) {
|
|
58
|
+
super.init(graph);
|
|
59
|
+
}
|
|
60
|
+
// class-methods-use-this
|
|
61
|
+
getEvents() {
|
|
62
|
+
return {
|
|
63
|
+
afteritemchange: this.handleNodesChange,
|
|
64
|
+
afterrender: this.handleAfterRender,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* viewport change
|
|
69
|
+
* @param param
|
|
70
|
+
*/
|
|
71
|
+
handleNodesChange(param) {
|
|
72
|
+
const { itemType, models, ids, action } = param;
|
|
73
|
+
if (itemType === 'edge' || action === 'add')
|
|
74
|
+
return;
|
|
75
|
+
if (action === 'remove') {
|
|
76
|
+
this.cacheChanges.remove = this.cacheChanges.remove.concat(ids);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.cacheChanges.update = this.cacheChanges.update.concat(models);
|
|
80
|
+
}
|
|
81
|
+
this.debounceUpdateMembers();
|
|
82
|
+
}
|
|
83
|
+
handleAfterRender() {
|
|
84
|
+
this.addHull(this.options.hulls);
|
|
85
|
+
}
|
|
86
|
+
addHull(options) {
|
|
87
|
+
const { padding, style, bubbleCfg, labelShape } = this.options;
|
|
88
|
+
const configs = isArray(options) ? options : [options];
|
|
89
|
+
configs.forEach((config) => {
|
|
90
|
+
const { id, style: singleStyle, labelShape: singleLabelShape, members } = config, others = __rest(config, ["id", "style", "labelShape", "members"]);
|
|
91
|
+
const validMembers = members === null || members === void 0 ? void 0 : members.filter((memberId) => this.graph.getNodeData(memberId) || this.graph.getComboData(memberId));
|
|
92
|
+
if (!(validMembers === null || validMembers === void 0 ? void 0 : validMembers.length)) {
|
|
93
|
+
console.warn(`Create hull failed. There are no valid members.`);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (validMembers.length !== members.length) {
|
|
97
|
+
console.warn(`Some member of hull ${id} is not exist in the graph. Hull ${id} is added without those invalid members.`);
|
|
98
|
+
}
|
|
99
|
+
const fullOptions = Object.assign({ id: `${this.key}-${id}`, padding,
|
|
100
|
+
bubbleCfg, style: Object.assign(Object.assign({}, style), singleStyle), labelShape: (singleLabelShape === null || singleLabelShape === void 0 ? void 0 : singleLabelShape.text)
|
|
101
|
+
? Object.assign(Object.assign({}, labelShape), singleLabelShape) : undefined, members: validMembers }, others);
|
|
102
|
+
if (this.hullMap[id]) {
|
|
103
|
+
this.updateHull(fullOptions);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this.hullMap[id] = new HullComponent(this.graph, fullOptions);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
updateHull(options) {
|
|
110
|
+
const configs = isArray(options) ? options : [options];
|
|
111
|
+
configs.forEach((config) => {
|
|
112
|
+
const { id } = config, others = __rest(config, ["id"]);
|
|
113
|
+
if (!this.hullMap[id]) {
|
|
114
|
+
console.warn(`Update hull component failed. The bubble with id ${id} is not existed.`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.hullMap[id].updateOptions(others);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
removeHull(ids) {
|
|
121
|
+
const idArr = isArray(ids) ? ids : [ids];
|
|
122
|
+
idArr.forEach((id) => {
|
|
123
|
+
const hullComponent = this.hullMap[id];
|
|
124
|
+
hullComponent.destroy();
|
|
125
|
+
delete this.hullMap[id];
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
addHullMember(id, members) {
|
|
129
|
+
const hullComponent = this.hullMap[id];
|
|
130
|
+
if (!hullComponent) {
|
|
131
|
+
console.warn(`Add member to hull faield. The hull with id ${id} is not exist`);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
hullComponent.addMember(members);
|
|
135
|
+
}
|
|
136
|
+
removeHullMember(id, members) {
|
|
137
|
+
const hullComponent = this.hullMap[id];
|
|
138
|
+
if (!hullComponent) {
|
|
139
|
+
console.warn(`Remove member from hull faield. The hull with id ${id} is not exist`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
hullComponent.removeMember(members);
|
|
143
|
+
}
|
|
144
|
+
addHullNonMember(id, members) {
|
|
145
|
+
const hullComponent = this.hullMap[id];
|
|
146
|
+
if (!hullComponent) {
|
|
147
|
+
console.warn(`Add non member to hull faield. The hull with id ${id} is not exist`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
hullComponent.addNonMember(members);
|
|
151
|
+
}
|
|
152
|
+
removeHullNonMember(id, members) {
|
|
153
|
+
const hullComponent = this.hullMap[id];
|
|
154
|
+
if (!hullComponent) {
|
|
155
|
+
console.warn(`Remove non member from hull faield. The hull with id ${id} is not exist`);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
hullComponent.removeNonMember(members);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["stdlib/plugin/hull/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface BubblesetCfg {
|
|
2
|
+
morphBuffer?: number;
|
|
3
|
+
pixelGroupSize?: number;
|
|
4
|
+
maxMarchingIterations?: number;
|
|
5
|
+
maxRoutingIterations?: number;
|
|
6
|
+
nodeR0?: number;
|
|
7
|
+
nodeR1?: number;
|
|
8
|
+
edgeR0?: number;
|
|
9
|
+
edgeR1?: number;
|
|
10
|
+
nodeInfluenceFactor?: number;
|
|
11
|
+
negativeNodeInfluenceFactor?: number;
|
|
12
|
+
edgeInfluenceFactor?: number;
|
|
13
|
+
memberInfluenceFactor?: number;
|
|
14
|
+
nonMemberInfluenceFactor?: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"src/","sources":["stdlib/plugin/hull/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { vec2 } from '@antv/matrix-util';
|
|
2
|
+
import { ID, IGraph } from 'types';
|
|
3
|
+
import { AABB } from '@antv/g';
|
|
4
|
+
import { Bounds, Point } from '../../../types/common';
|
|
5
|
+
/**
|
|
6
|
+
* Generate smooth closed curves.
|
|
7
|
+
* @param points points of the curves.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getClosedSpline: (points: Point[]) => any[];
|
|
10
|
+
/**
|
|
11
|
+
* The incoming node is used as the vertices of the polygon to generate a polygon with rounded corners.
|
|
12
|
+
* @param polyPoints vertex points of the polygon.
|
|
13
|
+
* @param padding Increase the blank space between the final outline and the original polygon on the basis of the original polygon.
|
|
14
|
+
*/
|
|
15
|
+
export declare function roundedHull(polyPoints: vec2[], padding: number): string;
|
|
16
|
+
/**
|
|
17
|
+
* The incoming nodes are used as polygon vertices to generate a smooth closed polygon
|
|
18
|
+
* @param polyPoints vertex points of the polygon.
|
|
19
|
+
* @param padding Increase the blank space between the final outline and the original polygon on the basis of the original polygon.
|
|
20
|
+
*/
|
|
21
|
+
export declare function paddedHull(polyPoints: vec2[], padding: number): string | {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
}[];
|
|
25
|
+
export declare const pointLineSquareDist: (point: Point, line: LineStructure) => number;
|
|
26
|
+
export declare class LineStructure {
|
|
27
|
+
x1: number;
|
|
28
|
+
y1: number;
|
|
29
|
+
x2: number;
|
|
30
|
+
y2: number;
|
|
31
|
+
constructor(x1: number, y1: number, x2: number, y2: number);
|
|
32
|
+
getBBox(): Bounds;
|
|
33
|
+
}
|
|
34
|
+
export declare const getPointsCenter: (points: Point[]) => Point;
|
|
35
|
+
export declare const squareDist: (a: Point, b: Point) => number;
|
|
36
|
+
export declare const fractionToLine: (graph: IGraph, itemId: ID, line: LineStructure) => number;
|
|
37
|
+
export declare const getBBoxBoundLine: (bbox: AABB, direction: string) => any;
|
|
38
|
+
export declare const isPointsOverlap: (p1: any, p2: any, e?: number) => boolean;
|
|
39
|
+
export declare const itemIntersectByLine: (graph: IGraph, itemId: ID, line: LineStructure) => [Point[], number];
|
|
40
|
+
/**
|
|
41
|
+
* The square of the distance from the point to the rectangle: the distance from the point inside the rectangle is 0, if the projection of the point outside falls on the side of the rectangle, it is the nearest vertical distance from the point to the side of the rectangle, otherwise it is the distance from the point to the vertex of the rectangle.
|
|
42
|
+
* @param point Point
|
|
43
|
+
* @param rect Rect
|
|
44
|
+
*/
|
|
45
|
+
export declare const pointRectSquareDist: (point: Point, rect: {
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
}) => number;
|
|
51
|
+
/**
|
|
52
|
+
* Get the intersect point and line of a polygon (represented by points) and a line (represented by 2 points).
|
|
53
|
+
* @param polygonPoints Vertex points of the polygon.
|
|
54
|
+
* @param line Start and end points of the line.
|
|
55
|
+
* @returns The intersect point and the intersected line of polygon.
|
|
56
|
+
*/
|
|
57
|
+
export declare const getPolygonIntersectByLine: (polygonPoints: [number, number][], line: [Point, Point]) => {
|
|
58
|
+
point: Point;
|
|
59
|
+
line: [Point, Point];
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Calculates the extended point along the line from point2 to point1.
|
|
63
|
+
* @param point1 The first point in the line. And the extended point will on the point1 side.
|
|
64
|
+
* @param point2 The second point in the line.
|
|
65
|
+
* @param diff The distance by which to extend the line.
|
|
66
|
+
* @returns The extended point on the line.
|
|
67
|
+
*/
|
|
68
|
+
export declare const getExtendPoint: (point1: any, point2: any, diff: any) => {
|
|
69
|
+
x: any;
|
|
70
|
+
y: any;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Get the inverted value of baseline.
|
|
74
|
+
* @param baseline
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
export declare const getInvertBaseline: (baseline: string) => string;
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { vec2 } from '@antv/matrix-util';
|
|
2
|
+
import { getLineIntersect } from '../../../util/shape';
|
|
3
|
+
/**
|
|
4
|
+
* Generate smooth closed curves.
|
|
5
|
+
* @param points points of the curves.
|
|
6
|
+
*/
|
|
7
|
+
export const getClosedSpline = (points) => {
|
|
8
|
+
if (points.length < 2) {
|
|
9
|
+
throw new Error(`point length must largn than 2, now it's ${points.length}`);
|
|
10
|
+
}
|
|
11
|
+
const first = points[0];
|
|
12
|
+
const second = points[1];
|
|
13
|
+
const last = points[points.length - 1];
|
|
14
|
+
const lastSecond = points[points.length - 2];
|
|
15
|
+
points.unshift(last);
|
|
16
|
+
points.unshift(lastSecond);
|
|
17
|
+
points.push(first);
|
|
18
|
+
points.push(second);
|
|
19
|
+
const closedPath = [];
|
|
20
|
+
for (let i = 1; i < points.length - 2; i += 1) {
|
|
21
|
+
const x0 = points[i - 1].x;
|
|
22
|
+
const y0 = points[i - 1].y;
|
|
23
|
+
const x1 = points[i].x;
|
|
24
|
+
const y1 = points[i].y;
|
|
25
|
+
const x2 = points[i + 1].x;
|
|
26
|
+
const y2 = points[i + 1].y;
|
|
27
|
+
const x3 = i !== points.length - 2 ? points[i + 2].x : x2;
|
|
28
|
+
const y3 = i !== points.length - 2 ? points[i + 2].y : y2;
|
|
29
|
+
const cp1x = x1 + (x2 - x0) / 6;
|
|
30
|
+
const cp1y = y1 + (y2 - y0) / 6;
|
|
31
|
+
const cp2x = x2 - (x3 - x1) / 6;
|
|
32
|
+
const cp2y = y2 - (y3 - y1) / 6;
|
|
33
|
+
closedPath.push(['C', cp1x, cp1y, cp2x, cp2y, x2, y2]);
|
|
34
|
+
}
|
|
35
|
+
closedPath.unshift(['M', last.x, last.y]);
|
|
36
|
+
return closedPath;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The incoming node is used as the vertices of the polygon to generate a polygon with rounded corners.
|
|
40
|
+
* @param polyPoints vertex points of the polygon.
|
|
41
|
+
* @param padding Increase the blank space between the final outline and the original polygon on the basis of the original polygon.
|
|
42
|
+
*/
|
|
43
|
+
export function roundedHull(polyPoints, padding) {
|
|
44
|
+
// The rounded hull path around a single point
|
|
45
|
+
const roundedHull1 = (points) => {
|
|
46
|
+
const p1 = [points[0][0], points[0][1] - padding];
|
|
47
|
+
const p2 = [points[0][0], points[0][1] + padding];
|
|
48
|
+
return `M ${p1} A ${padding},${padding},0,0,0,${p2} A ${padding},${padding},0,0,0,${p1}`;
|
|
49
|
+
};
|
|
50
|
+
// The rounded hull path around two points
|
|
51
|
+
const roundedHull2 = (points) => {
|
|
52
|
+
const offsetVector = vec2.scale([0, 0], unitNormal(points[0], points[1]), padding);
|
|
53
|
+
const invOffsetVector = vec2.scale([0, 0], offsetVector, -1);
|
|
54
|
+
const p0 = vec2.add([0, 0], points[0], offsetVector);
|
|
55
|
+
const p1 = vec2.add([0, 0], points[1], offsetVector);
|
|
56
|
+
const p2 = vec2.add([0, 0], points[1], invOffsetVector);
|
|
57
|
+
const p3 = vec2.add([0, 0], points[0], invOffsetVector);
|
|
58
|
+
return `M ${p0} L ${p1} A ${[padding, padding, '0,0,0', p2].join(',')} L ${p3} A ${[padding, padding, '0,0,0', p0].join(',')}`;
|
|
59
|
+
};
|
|
60
|
+
// Special case handling: the number of nodes is less than or equal to 2
|
|
61
|
+
if (!polyPoints || polyPoints.length < 1)
|
|
62
|
+
return '';
|
|
63
|
+
if (polyPoints.length === 1)
|
|
64
|
+
return roundedHull1(polyPoints);
|
|
65
|
+
if (polyPoints.length === 2)
|
|
66
|
+
return roundedHull2(polyPoints);
|
|
67
|
+
let segments = new Array(polyPoints.length);
|
|
68
|
+
// Calculate each offset (outwards) segment of the convex hull.
|
|
69
|
+
for (let segmentIndex = 0; segmentIndex < segments.length; ++segmentIndex) {
|
|
70
|
+
const p0 = segmentIndex === 0
|
|
71
|
+
? polyPoints[polyPoints.length - 1]
|
|
72
|
+
: polyPoints[segmentIndex - 1];
|
|
73
|
+
const p1 = polyPoints[segmentIndex];
|
|
74
|
+
// Compute the offset vector for the line segment, with length = padding.
|
|
75
|
+
const offset = vec2.scale([0, 0], unitNormal(p0, p1), padding);
|
|
76
|
+
segments[segmentIndex] = [
|
|
77
|
+
vec2.add([0, 0], p0, offset),
|
|
78
|
+
vec2.add([0, 0], p1, offset),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
const arcData = `A ${[padding, padding, '0,0,0,'].join(',')}`;
|
|
82
|
+
segments = segments.map((segment, index) => {
|
|
83
|
+
let pathFragment = '';
|
|
84
|
+
if (index === 0) {
|
|
85
|
+
pathFragment = `M ${segments[segments.length - 1][1]} `;
|
|
86
|
+
}
|
|
87
|
+
pathFragment += `${arcData + segment[0]} L ${segment[1]}`;
|
|
88
|
+
return pathFragment;
|
|
89
|
+
});
|
|
90
|
+
return segments.join(' ');
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The incoming nodes are used as polygon vertices to generate a smooth closed polygon
|
|
94
|
+
* @param polyPoints vertex points of the polygon.
|
|
95
|
+
* @param padding Increase the blank space between the final outline and the original polygon on the basis of the original polygon.
|
|
96
|
+
*/
|
|
97
|
+
export function paddedHull(polyPoints, padding) {
|
|
98
|
+
const pointCount = polyPoints.length;
|
|
99
|
+
const smoothHull1 = (points) => {
|
|
100
|
+
// Returns the path for a circular hull around a single point.
|
|
101
|
+
const p1 = [points[0][0], points[0][1] - padding];
|
|
102
|
+
const p2 = [points[0][0], points[0][1] + padding];
|
|
103
|
+
return `M ${p1} A ${[padding, padding, '0,0,0', p2].join(',')} A ${[
|
|
104
|
+
padding,
|
|
105
|
+
padding,
|
|
106
|
+
'0,0,0',
|
|
107
|
+
p1,
|
|
108
|
+
].join(',')}`;
|
|
109
|
+
};
|
|
110
|
+
// Returns the path for a rounded hull around two points.
|
|
111
|
+
const smoothHull2 = (points) => {
|
|
112
|
+
const v = vecFrom(points[0], points[1]);
|
|
113
|
+
const extensionVec = vecScaleTo(v, padding);
|
|
114
|
+
const extension0 = vec2.add([0, 0], points[0], vec2.scale([0, 0], extensionVec, -1));
|
|
115
|
+
const extension1 = vec2.add([0, 0], points[1], extensionVec);
|
|
116
|
+
const tangentHalfLength = 1.2 * padding;
|
|
117
|
+
const controlDelta = vecScaleTo(vec2.normalize([0, 0], v), tangentHalfLength);
|
|
118
|
+
const invControlDelta = vec2.scale([0, 0], controlDelta, -1);
|
|
119
|
+
const control0 = vec2.add([0, 0], extension0, invControlDelta);
|
|
120
|
+
const control1 = vec2.add([0, 0], extension1, invControlDelta);
|
|
121
|
+
const control3 = vec2.add([0, 0], extension0, controlDelta);
|
|
122
|
+
return `M ${extension0} C ${[control0, control1, extension1].join(',')} S ${[control3, extension0].join(',')} Z`;
|
|
123
|
+
};
|
|
124
|
+
// Handle special cases
|
|
125
|
+
if (!polyPoints || pointCount < 1)
|
|
126
|
+
return '';
|
|
127
|
+
if (pointCount === 1)
|
|
128
|
+
return smoothHull1(polyPoints);
|
|
129
|
+
if (pointCount === 2)
|
|
130
|
+
return smoothHull2(polyPoints);
|
|
131
|
+
const hullPoints = polyPoints.map((point, index) => {
|
|
132
|
+
const pNext = polyPoints[(index + 1) % pointCount];
|
|
133
|
+
return {
|
|
134
|
+
p: point,
|
|
135
|
+
v: vec2.normalize([0, 0], vecFrom(point, pNext)),
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
// Compute the expanded hull points, and the nearest prior control point for each.
|
|
139
|
+
for (let i = 0; i < hullPoints.length; ++i) {
|
|
140
|
+
const priorIndex = i > 0 ? i - 1 : pointCount - 1;
|
|
141
|
+
const extensionVec = vec2.normalize([0, 0], vec2.add([0, 0], hullPoints[priorIndex].v, vec2.scale([0, 0], hullPoints[i].v, -1)));
|
|
142
|
+
hullPoints[i].p = vec2.add([0, 0], hullPoints[i].p, vec2.scale([0, 0], extensionVec, padding));
|
|
143
|
+
}
|
|
144
|
+
return hullPoints.map((obj) => {
|
|
145
|
+
const point = obj.p;
|
|
146
|
+
return { x: point[0], y: point[1] };
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
const unitNormal = (p0, p1) => {
|
|
150
|
+
// Returns the unit normal to the line segment from p0 to p1.
|
|
151
|
+
const n = [p0[1] - p1[1], p1[0] - p0[0]];
|
|
152
|
+
const nLength = Math.sqrt(n[0] * n[0] + n[1] * n[1]);
|
|
153
|
+
if (nLength === 0) {
|
|
154
|
+
throw new Error('p0 should not be equal to p1');
|
|
155
|
+
}
|
|
156
|
+
return [n[0] / nLength, n[1] / nLength];
|
|
157
|
+
};
|
|
158
|
+
const vecFrom = (p0, p1) => {
|
|
159
|
+
// Vector from p0 to p1
|
|
160
|
+
return [p1[0] - p0[0], p1[1] - p0[1]];
|
|
161
|
+
};
|
|
162
|
+
const vecScaleTo = (v, length) => {
|
|
163
|
+
// Vector with direction of v with specified length
|
|
164
|
+
return vec2.scale([0, 0], vec2.normalize([0, 0], v), length);
|
|
165
|
+
};
|
|
166
|
+
export const pointLineSquareDist = (point, line) => {
|
|
167
|
+
const x1 = line.x1;
|
|
168
|
+
const y1 = line.y1;
|
|
169
|
+
const x2 = line.x2 - x1;
|
|
170
|
+
const y2 = line.y2 - y1;
|
|
171
|
+
let px = point.x - x1;
|
|
172
|
+
let py = point.y - y1;
|
|
173
|
+
let dotprod = px * x2 + py * y2;
|
|
174
|
+
let projlenSq;
|
|
175
|
+
if (dotprod <= 0) {
|
|
176
|
+
projlenSq = 0;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
px = x2 - px;
|
|
180
|
+
py = y2 - py;
|
|
181
|
+
dotprod = px * x2 + py * y2;
|
|
182
|
+
if (dotprod <= 0) {
|
|
183
|
+
projlenSq = 0;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
projlenSq = (dotprod * dotprod) / (x2 * x2 + y2 * y2);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
let lenSq = px * px + py * py - projlenSq;
|
|
190
|
+
if (lenSq < 0) {
|
|
191
|
+
lenSq = 0;
|
|
192
|
+
}
|
|
193
|
+
return lenSq;
|
|
194
|
+
};
|
|
195
|
+
export class LineStructure {
|
|
196
|
+
constructor(x1, y1, x2, y2) {
|
|
197
|
+
this.x1 = x1;
|
|
198
|
+
this.y1 = y1;
|
|
199
|
+
this.x2 = x2;
|
|
200
|
+
this.y2 = y2;
|
|
201
|
+
}
|
|
202
|
+
getBBox() {
|
|
203
|
+
const minX = Math.min(this.x1, this.x2);
|
|
204
|
+
const minY = Math.min(this.y1, this.y2);
|
|
205
|
+
const maxX = Math.max(this.x1, this.x2);
|
|
206
|
+
const maxY = Math.max(this.y1, this.y2);
|
|
207
|
+
const res = {
|
|
208
|
+
min: [minX, minY],
|
|
209
|
+
max: [maxX, maxY],
|
|
210
|
+
center: [(minX + maxX) / 2, (minY + maxY) / 2],
|
|
211
|
+
halfExtents: [(maxX - minX) / 2, (maxY - minY) / 2],
|
|
212
|
+
};
|
|
213
|
+
return res;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
export const getPointsCenter = (points) => {
|
|
217
|
+
let centerX = 0;
|
|
218
|
+
let centerY = 0;
|
|
219
|
+
if (points.length > 0) {
|
|
220
|
+
for (const point of points) {
|
|
221
|
+
centerX += point.x;
|
|
222
|
+
centerY += point.y;
|
|
223
|
+
}
|
|
224
|
+
centerX /= points.length;
|
|
225
|
+
centerY /= points.length;
|
|
226
|
+
}
|
|
227
|
+
return { x: centerX, y: centerY };
|
|
228
|
+
};
|
|
229
|
+
export const squareDist = (a, b) => {
|
|
230
|
+
return Math.pow((a.x - b.x), 2) + Math.pow((a.y - b.y), 2);
|
|
231
|
+
};
|
|
232
|
+
export const fractionToLine = (graph, itemId, line) => {
|
|
233
|
+
const directions = ['top', 'left', 'bottom', 'right'];
|
|
234
|
+
const bbox = graph.getRenderBBox(itemId);
|
|
235
|
+
if (!bbox)
|
|
236
|
+
return Infinity;
|
|
237
|
+
let minDistance = Number.POSITIVE_INFINITY;
|
|
238
|
+
let countIntersections = 0;
|
|
239
|
+
for (let i = 0; i < 4; i++) {
|
|
240
|
+
const [x1, y1, x2, y2] = getBBoxBoundLine(bbox, directions[i]);
|
|
241
|
+
let testDistance = fractionAlongLineA(line, new LineStructure(x1, y1, x2, y2));
|
|
242
|
+
testDistance = Math.abs(testDistance - 0.5);
|
|
243
|
+
if (testDistance >= 0 && testDistance <= 1) {
|
|
244
|
+
countIntersections += 1;
|
|
245
|
+
minDistance = testDistance < minDistance ? testDistance : minDistance;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (countIntersections === 0)
|
|
249
|
+
return -1;
|
|
250
|
+
return minDistance;
|
|
251
|
+
};
|
|
252
|
+
export const getBBoxBoundLine = (bbox, direction) => {
|
|
253
|
+
const bounds = {
|
|
254
|
+
top: [bbox.min[0], bbox.min[1], bbox.max[0], bbox.min[1]],
|
|
255
|
+
left: [bbox.min[0], bbox.min[1], bbox.min[0], bbox.max[1]],
|
|
256
|
+
bottom: [bbox.min[0], bbox.max[1], bbox.max[0], bbox.max[1]],
|
|
257
|
+
right: [bbox.max[0], bbox.min[1], bbox.max[0], bbox.max[1]],
|
|
258
|
+
};
|
|
259
|
+
return bounds[direction];
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* When calculating the intersection of two line segments, the division ratio of the intersection point to the first line segment.
|
|
263
|
+
*/
|
|
264
|
+
const fractionAlongLineA = (la, lb) => {
|
|
265
|
+
const uaT = (lb.x2 - lb.x1) * (la.y1 - lb.y1) - (lb.y2 - lb.y1) * (la.x1 - lb.x1);
|
|
266
|
+
const ubT = (la.x2 - la.x1) * (la.y1 - lb.y1) - (la.y2 - la.y1) * (la.x1 - lb.x1);
|
|
267
|
+
const uB = (lb.y2 - lb.y1) * (la.x2 - la.x1) - (lb.x2 - lb.x1) * (la.y2 - la.y1);
|
|
268
|
+
if (uB) {
|
|
269
|
+
const ua = uaT / uB;
|
|
270
|
+
const ub = ubT / uB;
|
|
271
|
+
if (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {
|
|
272
|
+
return ua;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return Number.POSITIVE_INFINITY;
|
|
276
|
+
};
|
|
277
|
+
export const isPointsOverlap = (p1, p2, e = 1e-3) => {
|
|
278
|
+
return Math.pow((p1.x - p2.x), 2) + Math.pow((p1.y - p2.y), 2) < Math.pow(e, 2);
|
|
279
|
+
};
|
|
280
|
+
export const itemIntersectByLine = (graph, itemId, line) => {
|
|
281
|
+
const directions = ['top', 'left', 'bottom', 'right'];
|
|
282
|
+
const bbox = graph.getRenderBBox(itemId);
|
|
283
|
+
if (!bbox)
|
|
284
|
+
return;
|
|
285
|
+
let countIntersections = 0;
|
|
286
|
+
const intersections = [];
|
|
287
|
+
for (let i = 0; i < 4; i++) {
|
|
288
|
+
const [x1, y1, x2, y2] = getBBoxBoundLine(bbox, directions[i]);
|
|
289
|
+
intersections[i] = getLineIntersect({ x: line.x1, y: line.y1 }, { x: line.x2, y: line.y2 }, { x: x1, y: y1 }, { x: x2, y: y2 });
|
|
290
|
+
if (intersections[i]) {
|
|
291
|
+
countIntersections += 1;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return [intersections, countIntersections];
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* The square of the distance from the point to the rectangle: the distance from the point inside the rectangle is 0, if the projection of the point outside falls on the side of the rectangle, it is the nearest vertical distance from the point to the side of the rectangle, otherwise it is the distance from the point to the vertex of the rectangle.
|
|
298
|
+
* @param point Point
|
|
299
|
+
* @param rect Rect
|
|
300
|
+
*/
|
|
301
|
+
export const pointRectSquareDist = (point, rect) => {
|
|
302
|
+
const isLeft = point.x < rect.x;
|
|
303
|
+
const isRight = point.x > rect.x + rect.width;
|
|
304
|
+
const isTop = point.y > rect.y + rect.height;
|
|
305
|
+
const isBottom = point.y < rect.y;
|
|
306
|
+
const isPointOutside = isLeft || isRight || isTop || isBottom;
|
|
307
|
+
if (!isPointOutside) {
|
|
308
|
+
return 0;
|
|
309
|
+
}
|
|
310
|
+
if (isTop && !isLeft && !isRight) {
|
|
311
|
+
return Math.pow((rect.y + rect.height - point.y), 2);
|
|
312
|
+
}
|
|
313
|
+
if (isBottom && !isLeft && !isRight) {
|
|
314
|
+
return Math.pow((point.y - rect.y), 2);
|
|
315
|
+
}
|
|
316
|
+
if (isLeft && !isTop && !isBottom) {
|
|
317
|
+
return Math.pow((rect.x - point.x), 2);
|
|
318
|
+
}
|
|
319
|
+
if (isRight && !isTop && !isBottom) {
|
|
320
|
+
return Math.pow((rect.x + rect.width - point.x), 2);
|
|
321
|
+
}
|
|
322
|
+
const dx = Math.min(Math.abs(rect.x - point.x), Math.abs(rect.x + rect.width - point.x));
|
|
323
|
+
const dy = Math.min(Math.abs(rect.y - point.y), Math.abs(rect.y + rect.height - point.y));
|
|
324
|
+
return dx * dx + dy * dy;
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* Get the intersect point and line of a polygon (represented by points) and a line (represented by 2 points).
|
|
328
|
+
* @param polygonPoints Vertex points of the polygon.
|
|
329
|
+
* @param line Start and end points of the line.
|
|
330
|
+
* @returns The intersect point and the intersected line of polygon.
|
|
331
|
+
*/
|
|
332
|
+
export const getPolygonIntersectByLine = (polygonPoints, line) => {
|
|
333
|
+
const polygonPointsLength = polygonPoints.length;
|
|
334
|
+
const lineMap = {};
|
|
335
|
+
for (let i = 0; i < polygonPointsLength - 1; i++) {
|
|
336
|
+
const start = { x: polygonPoints[i][0], y: polygonPoints[i][1] };
|
|
337
|
+
const end = { x: polygonPoints[i + 1][0], y: polygonPoints[i + 1][1] };
|
|
338
|
+
if (start.x === end.x && start.y === end.y)
|
|
339
|
+
continue;
|
|
340
|
+
const key = `${start.x}-${start.y}-${end.x}-${end.y}`;
|
|
341
|
+
if (lineMap[key])
|
|
342
|
+
continue;
|
|
343
|
+
lineMap[key] = true;
|
|
344
|
+
const intersect = getLineIntersect(start, end, line[0], line[1]);
|
|
345
|
+
if (intersect) {
|
|
346
|
+
return {
|
|
347
|
+
point: intersect,
|
|
348
|
+
line: [start, end],
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return;
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Calculates the extended point along the line from point2 to point1.
|
|
356
|
+
* @param point1 The first point in the line. And the extended point will on the point1 side.
|
|
357
|
+
* @param point2 The second point in the line.
|
|
358
|
+
* @param diff The distance by which to extend the line.
|
|
359
|
+
* @returns The extended point on the line.
|
|
360
|
+
*/
|
|
361
|
+
export const getExtendPoint = (point1, point2, diff) => {
|
|
362
|
+
const k = (point2.y - point1.y) / (point2.x - point1.x);
|
|
363
|
+
if (Math.abs(k) === Infinity) {
|
|
364
|
+
return {
|
|
365
|
+
x: point1.x,
|
|
366
|
+
y: point2.y > point1.y ? point1.y - diff : point1.y + diff,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
if (k === 0) {
|
|
370
|
+
return {
|
|
371
|
+
x: point2.x > point1.x ? point1.x - diff : point1.x + diff,
|
|
372
|
+
y: point2.y,
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
const b = point1.y - k * point1.x;
|
|
376
|
+
const diffSign = point2.x > point1.x ? -1 : 1;
|
|
377
|
+
const extendedX = point1.x + diffSign * diff;
|
|
378
|
+
return {
|
|
379
|
+
x: extendedX,
|
|
380
|
+
y: k * extendedX + b,
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Get the inverted value of baseline.
|
|
385
|
+
* @param baseline
|
|
386
|
+
* @returns
|
|
387
|
+
*/
|
|
388
|
+
export const getInvertBaseline = (baseline) => {
|
|
389
|
+
switch (baseline) {
|
|
390
|
+
case 'top':
|
|
391
|
+
return 'bottom';
|
|
392
|
+
case 'bottom':
|
|
393
|
+
return 'top';
|
|
394
|
+
case 'left':
|
|
395
|
+
return 'right';
|
|
396
|
+
case 'right':
|
|
397
|
+
default:
|
|
398
|
+
return 'left';
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
//# sourceMappingURL=util.js.map
|