@antv/g6 5.0.0-beta.2 → 5.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g6.min.js +2 -2
- package/esm/api-doc/graph.d.ts +3 -3
- package/esm/api-doc/graph.js +3 -3
- package/esm/api-doc/graph.js.map +1 -1
- package/esm/api-doc/types.d.ts +1 -0
- package/esm/api-doc/types.js +1 -2
- package/esm/api-doc/types.js.map +1 -1
- package/esm/constant/shape.d.ts +3 -1
- package/esm/index.d.ts +24 -63
- package/esm/index.js +4 -5
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +1 -1
- package/esm/item/combo.js +18 -14
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +19 -2
- package/esm/item/edge.js +100 -44
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +3 -2
- package/esm/item/item.js +27 -13
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +2 -8
- package/esm/item/node.js +31 -19
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +7 -10
- package/esm/runtime/controller/data.js +125 -281
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/interaction.js +9 -4
- package/esm/runtime/controller/interaction.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +1 -0
- package/esm/runtime/controller/item.js +285 -150
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.js +1 -3
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/controller/plugin.js +9 -5
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/graph.d.ts +104 -24
- package/esm/runtime/graph.js +472 -94
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +1 -1
- package/esm/stdlib/behavior/activate-relations.js +2 -2
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.d.ts +9 -3
- package/esm/stdlib/behavior/brush-select.js +10 -12
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/click-select.d.ts +1 -1
- package/esm/stdlib/behavior/click-select.js +1 -1
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/collapse-expand-combo.d.ts +1 -1
- package/esm/stdlib/behavior/collapse-expand-tree.d.ts +1 -1
- package/esm/stdlib/behavior/create-edge.d.ts +57 -0
- package/esm/stdlib/behavior/create-edge.js +215 -0
- package/esm/stdlib/behavior/create-edge.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +3 -1
- package/esm/stdlib/behavior/drag-canvas.js +78 -33
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +3 -3
- package/esm/stdlib/behavior/drag-combo.js +43 -32
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.d.ts +4 -4
- package/esm/stdlib/behavior/drag-node.js +80 -63
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/index.d.ts +3 -0
- package/esm/stdlib/behavior/index.js +3 -0
- package/esm/stdlib/behavior/index.js.map +1 -1
- package/esm/stdlib/behavior/lasso-select.d.ts +1 -1
- package/esm/stdlib/behavior/lasso-select.js +3 -4
- package/esm/stdlib/behavior/lasso-select.js.map +1 -1
- package/esm/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/esm/stdlib/behavior/scroll-canvas.js +266 -0
- package/esm/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/esm/stdlib/behavior/shortcuts-call.d.ts +38 -0
- package/esm/stdlib/behavior/shortcuts-call.js +87 -0
- package/esm/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.d.ts +3 -1
- package/esm/stdlib/behavior/zoom-canvas.js +70 -26
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/mapNodeSize.d.ts +2 -2
- package/esm/stdlib/data/mapNodeSize.js +2 -2
- package/esm/stdlib/data/mapNodeSize.js.map +1 -1
- package/esm/stdlib/data/transformV4Data.d.ts +2 -2
- package/esm/stdlib/data/transformV4Data.js +2 -2
- package/esm/stdlib/data/transformV4Data.js.map +1 -1
- package/esm/stdlib/data/validateData.d.ts +2 -2
- package/esm/stdlib/data/validateData.js +13 -12
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +18 -6
- package/esm/stdlib/index.js +22 -10
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +3 -5
- package/esm/stdlib/item/edge/base.js +32 -31
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/esm/stdlib/item/edge/cubic.js +1 -1
- package/esm/stdlib/item/edge/cubic.js.map +1 -1
- package/esm/stdlib/item/edge/loop.js +1 -1
- package/esm/stdlib/item/edge/loop.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +3 -6
- package/esm/stdlib/item/node/base.js +30 -60
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.d.ts +1 -0
- package/esm/stdlib/item/node/base3d.js +1 -0
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/cube.d.ts +35 -0
- package/esm/stdlib/item/node/cube.js +54 -0
- package/esm/stdlib/item/node/cube.js.map +1 -0
- package/esm/stdlib/item/node/diamond.js +1 -1
- package/esm/stdlib/item/node/donut.d.ts +3 -3
- package/esm/stdlib/item/node/ellipse.js +2 -2
- package/esm/stdlib/item/node/hexagon.js +6 -2
- package/esm/stdlib/item/node/hexagon.js.map +1 -1
- package/esm/stdlib/item/node/image.d.ts +40 -0
- package/esm/stdlib/item/node/image.js +110 -0
- package/esm/stdlib/item/node/image.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +4 -0
- package/esm/stdlib/item/node/index.js +4 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js +309 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/esm/stdlib/plugin/grid/index.d.ts +1 -1
- package/esm/stdlib/plugin/grid/index.js +3 -4
- package/esm/stdlib/plugin/grid/index.js.map +1 -1
- package/esm/stdlib/plugin/history/combo-command.js +2 -2
- package/esm/stdlib/plugin/history/combo-command.js.map +1 -1
- package/esm/stdlib/plugin/history/index.d.ts +10 -10
- package/esm/stdlib/plugin/history/index.js +14 -14
- package/esm/stdlib/plugin/history/index.js.map +1 -1
- package/esm/stdlib/plugin/history/item-data-command.js +25 -16
- package/esm/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/esm/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/hull/convexHull.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +2 -2
- package/esm/stdlib/plugin/hull/hullComponent.js +5 -9
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/esm/stdlib/plugin/hull/util.d.ts +2 -2
- package/esm/stdlib/plugin/hull/util.js +6 -2
- package/esm/stdlib/plugin/hull/util.js.map +1 -1
- package/esm/stdlib/plugin/index.d.ts +2 -0
- package/esm/stdlib/plugin/index.js +2 -0
- package/esm/stdlib/plugin/index.js.map +1 -1
- package/esm/stdlib/plugin/legend/index.d.ts +3 -3
- package/esm/stdlib/plugin/legend/index.js +3 -3
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/menu/index.d.ts +4 -4
- package/esm/stdlib/plugin/menu/index.js +3 -3
- package/esm/stdlib/plugin/menu/index.js.map +1 -1
- package/esm/stdlib/plugin/minimap/index.d.ts +6 -2
- package/esm/stdlib/plugin/minimap/index.js +119 -12
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/snapline/index.d.ts +167 -0
- package/esm/stdlib/plugin/snapline/index.js +1063 -0
- package/esm/stdlib/plugin/snapline/index.js.map +1 -0
- package/esm/stdlib/plugin/timebar/index.d.ts +4 -4
- package/esm/stdlib/plugin/timebar/index.js +6 -6
- package/esm/stdlib/plugin/timebar/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/esm/stdlib/plugin/toolbar/index.js +4 -4
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/plugin/tooltip/index.d.ts +5 -5
- package/esm/stdlib/plugin/tooltip/index.js +3 -4
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
- package/esm/stdlib/plugin/types.d.ts +2 -0
- package/esm/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/esm/stdlib/plugin/watermaker/index.js +243 -0
- package/esm/stdlib/plugin/watermaker/index.js.map +1 -0
- package/esm/stdlib/theme/dark.js +42 -2
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/light.js +4 -4
- package/esm/types/animate.d.ts +2 -2
- package/esm/types/behavior.d.ts +1 -1
- package/esm/types/combo.d.ts +7 -7
- package/esm/types/common.d.ts +5 -5
- package/esm/types/data.d.ts +6 -6
- package/esm/types/edge.d.ts +9 -9
- package/esm/types/event.d.ts +2 -1
- package/esm/types/graph.d.ts +48 -22
- package/esm/types/history.d.ts +2 -2
- package/esm/types/hook.d.ts +23 -3
- package/esm/types/index.d.ts +2 -1
- package/esm/types/index.js +1 -0
- package/esm/types/index.js.map +1 -1
- package/esm/types/item.d.ts +18 -12
- package/esm/types/item.js.map +1 -1
- package/esm/types/layout.d.ts +6 -6
- package/esm/types/loop.d.ts +2 -2
- package/esm/types/node.d.ts +7 -7
- package/esm/types/plugin.d.ts +1 -1
- package/esm/types/render.d.ts +1 -1
- package/esm/types/spec.d.ts +19 -3
- package/esm/types/stdlib.d.ts +1 -1
- package/esm/types/theme.d.ts +8 -8
- package/esm/types/view.d.ts +7 -2
- package/esm/util/bbox.d.ts +16 -1
- package/esm/util/bbox.js +33 -5
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/behavior.d.ts +2 -2
- package/esm/util/behavior.js +2 -2
- package/esm/util/behavior.js.map +1 -1
- package/esm/util/data.d.ts +2 -2
- package/esm/util/data.js.map +1 -1
- package/esm/util/dom.d.ts +15 -0
- package/esm/util/dom.js +29 -0
- package/esm/util/dom.js.map +1 -0
- package/esm/util/event.d.ts +5 -3
- package/esm/util/event.js +8 -1
- package/esm/util/event.js.map +1 -1
- package/esm/util/extend.d.ts +1 -1
- package/esm/util/extend.js +0 -1
- package/esm/util/extend.js.map +1 -1
- package/esm/util/index.d.ts +7 -52
- package/esm/util/index.js +7 -23
- package/esm/util/index.js.map +1 -1
- package/esm/util/item.d.ts +16 -1
- package/esm/util/item.js +31 -8
- package/esm/util/item.js.map +1 -1
- package/esm/util/layout.d.ts +13 -2
- package/esm/util/layout.js +45 -0
- package/esm/util/layout.js.map +1 -1
- package/esm/util/loop.d.ts +1 -1
- package/esm/util/loop.js +4 -0
- package/esm/util/loop.js.map +1 -1
- package/esm/util/math.d.ts +1 -1
- package/esm/util/matrix.d.ts +6 -0
- package/esm/util/matrix.js +48 -0
- package/esm/util/matrix.js.map +1 -0
- package/esm/util/path.js +1 -1
- package/esm/util/path.js.map +1 -1
- package/esm/util/point.d.ts +1 -1
- package/esm/util/point.js +9 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/polyline.d.ts +2 -1
- package/esm/util/polyline.js +2 -1
- package/esm/util/polyline.js.map +1 -1
- package/esm/util/router.d.ts +1 -1
- package/esm/util/shape.d.ts +1 -2
- package/esm/util/shape.js +15 -25
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.js +16 -17
- package/esm/util/shape3d.js.map +1 -1
- package/esm/util/text.d.ts +1 -1
- package/esm/util/text.js +3 -2
- package/esm/util/text.js.map +1 -1
- package/esm/util/warn.d.ts +14 -0
- package/esm/util/warn.js +4 -0
- package/esm/util/warn.js.map +1 -0
- package/lib/api-doc/graph.d.ts +3 -3
- package/lib/api-doc/graph.js +27 -7
- package/lib/api-doc/graph.js.map +1 -1
- package/lib/api-doc/types.d.ts +1 -0
- package/lib/api-doc/types.js +2 -2
- package/lib/api-doc/types.js.map +1 -1
- package/lib/constant/shape.d.ts +3 -1
- package/lib/index.d.ts +24 -63
- package/lib/index.js +18 -10
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +1 -1
- package/lib/item/combo.js +18 -14
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +19 -2
- package/lib/item/edge.js +99 -43
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +3 -2
- package/lib/item/item.js +27 -13
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +2 -8
- package/lib/item/node.js +31 -19
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +7 -10
- package/lib/runtime/controller/data.js +125 -281
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/interaction.js +9 -4
- package/lib/runtime/controller/interaction.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +1 -0
- package/lib/runtime/controller/item.js +284 -149
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.js +1 -3
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/controller/plugin.js +9 -5
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/graph.d.ts +104 -24
- package/lib/runtime/graph.js +473 -94
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +1 -1
- package/lib/stdlib/behavior/activate-relations.js +2 -2
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.d.ts +9 -3
- package/lib/stdlib/behavior/brush-select.js +13 -12
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/click-select.d.ts +1 -1
- package/lib/stdlib/behavior/click-select.js +1 -1
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/collapse-expand-combo.d.ts +1 -1
- package/lib/stdlib/behavior/collapse-expand-tree.d.ts +1 -1
- package/lib/stdlib/behavior/create-edge.d.ts +57 -0
- package/lib/stdlib/behavior/create-edge.js +219 -0
- package/lib/stdlib/behavior/create-edge.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +3 -1
- package/lib/stdlib/behavior/drag-canvas.js +78 -33
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +3 -3
- package/lib/stdlib/behavior/drag-combo.js +43 -32
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.d.ts +4 -4
- package/lib/stdlib/behavior/drag-node.js +80 -63
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/index.d.ts +3 -0
- package/lib/stdlib/behavior/index.js +3 -0
- package/lib/stdlib/behavior/index.js.map +1 -1
- package/lib/stdlib/behavior/lasso-select.d.ts +1 -1
- package/lib/stdlib/behavior/lasso-select.js +6 -4
- package/lib/stdlib/behavior/lasso-select.js.map +1 -1
- package/lib/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/lib/stdlib/behavior/scroll-canvas.js +270 -0
- package/lib/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/lib/stdlib/behavior/shortcuts-call.d.ts +38 -0
- package/lib/stdlib/behavior/shortcuts-call.js +91 -0
- package/lib/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.d.ts +3 -1
- package/lib/stdlib/behavior/zoom-canvas.js +70 -26
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/mapNodeSize.d.ts +2 -2
- package/lib/stdlib/data/mapNodeSize.js +2 -2
- package/lib/stdlib/data/mapNodeSize.js.map +1 -1
- package/lib/stdlib/data/transformV4Data.d.ts +2 -2
- package/lib/stdlib/data/transformV4Data.js +2 -2
- package/lib/stdlib/data/transformV4Data.js.map +1 -1
- package/lib/stdlib/data/validateData.d.ts +2 -2
- package/lib/stdlib/data/validateData.js +13 -12
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +18 -6
- package/lib/stdlib/index.js +22 -10
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +3 -5
- package/lib/stdlib/item/edge/base.js +30 -29
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/lib/stdlib/item/edge/cubic.js +2 -2
- package/lib/stdlib/item/edge/cubic.js.map +1 -1
- package/lib/stdlib/item/edge/loop.js +3 -3
- package/lib/stdlib/item/edge/loop.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +3 -6
- package/lib/stdlib/item/node/base.js +29 -59
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.d.ts +1 -0
- package/lib/stdlib/item/node/base3d.js +1 -0
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/cube.d.ts +35 -0
- package/lib/stdlib/item/node/cube.js +58 -0
- package/lib/stdlib/item/node/cube.js.map +1 -0
- package/lib/stdlib/item/node/diamond.js +1 -1
- package/lib/stdlib/item/node/donut.d.ts +3 -3
- package/lib/stdlib/item/node/ellipse.js +2 -2
- package/lib/stdlib/item/node/hexagon.js +6 -2
- package/lib/stdlib/item/node/hexagon.js.map +1 -1
- package/lib/stdlib/item/node/image.d.ts +40 -0
- package/lib/stdlib/item/node/image.js +114 -0
- package/lib/stdlib/item/node/image.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +4 -0
- package/lib/stdlib/item/node/index.js +4 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js +313 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/lib/stdlib/plugin/grid/index.d.ts +1 -1
- package/lib/stdlib/plugin/grid/index.js +6 -7
- package/lib/stdlib/plugin/grid/index.js.map +1 -1
- package/lib/stdlib/plugin/history/combo-command.js +2 -2
- package/lib/stdlib/plugin/history/combo-command.js.map +1 -1
- package/lib/stdlib/plugin/history/index.d.ts +10 -10
- package/lib/stdlib/plugin/history/index.js +14 -14
- package/lib/stdlib/plugin/history/index.js.map +1 -1
- package/lib/stdlib/plugin/history/item-data-command.js +25 -16
- package/lib/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/lib/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/hull/convexHull.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +2 -2
- package/lib/stdlib/plugin/hull/hullComponent.js +5 -9
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/lib/stdlib/plugin/hull/util.d.ts +2 -2
- package/lib/stdlib/plugin/hull/util.js +26 -22
- package/lib/stdlib/plugin/hull/util.js.map +1 -1
- package/lib/stdlib/plugin/index.d.ts +2 -0
- package/lib/stdlib/plugin/index.js +2 -0
- package/lib/stdlib/plugin/index.js.map +1 -1
- package/lib/stdlib/plugin/legend/index.d.ts +3 -3
- package/lib/stdlib/plugin/legend/index.js +3 -3
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/menu/index.d.ts +4 -4
- package/lib/stdlib/plugin/menu/index.js +6 -6
- package/lib/stdlib/plugin/menu/index.js.map +1 -1
- package/lib/stdlib/plugin/minimap/index.d.ts +6 -2
- package/lib/stdlib/plugin/minimap/index.js +121 -14
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/snapline/index.d.ts +167 -0
- package/lib/stdlib/plugin/snapline/index.js +1067 -0
- package/lib/stdlib/plugin/snapline/index.js.map +1 -0
- package/lib/stdlib/plugin/timebar/index.d.ts +4 -4
- package/lib/stdlib/plugin/timebar/index.js +6 -6
- package/lib/stdlib/plugin/timebar/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/lib/stdlib/plugin/toolbar/index.js +5 -5
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/plugin/tooltip/index.d.ts +5 -5
- package/lib/stdlib/plugin/tooltip/index.js +10 -11
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
- package/lib/stdlib/plugin/types.d.ts +2 -0
- package/lib/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/lib/stdlib/plugin/watermaker/index.js +247 -0
- package/lib/stdlib/plugin/watermaker/index.js.map +1 -0
- package/lib/stdlib/theme/dark.js +42 -2
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/light.js +4 -4
- package/lib/types/animate.d.ts +2 -2
- package/lib/types/behavior.d.ts +1 -1
- package/lib/types/combo.d.ts +7 -7
- package/lib/types/common.d.ts +5 -5
- package/lib/types/data.d.ts +6 -6
- package/lib/types/edge.d.ts +9 -9
- package/lib/types/event.d.ts +2 -1
- package/lib/types/event.js +2 -2
- package/lib/types/event.js.map +1 -1
- package/lib/types/graph.d.ts +48 -22
- package/lib/types/history.d.ts +2 -2
- package/lib/types/history.js +1 -1
- package/lib/types/history.js.map +1 -1
- package/lib/types/hook.d.ts +23 -3
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.js +3 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/item.d.ts +18 -12
- package/lib/types/item.js +1 -1
- package/lib/types/item.js.map +1 -1
- package/lib/types/layout.d.ts +6 -6
- package/lib/types/loop.d.ts +2 -2
- package/lib/types/loop.js +1 -1
- package/lib/types/loop.js.map +1 -1
- package/lib/types/node.d.ts +7 -7
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/render.d.ts +1 -1
- package/lib/types/spec.d.ts +19 -3
- package/lib/types/stdlib.d.ts +1 -1
- package/lib/types/theme.d.ts +8 -8
- package/lib/types/view.d.ts +7 -2
- package/lib/util/bbox.d.ts +16 -1
- package/lib/util/bbox.js +36 -6
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/behavior.d.ts +2 -2
- package/lib/util/behavior.js +2 -2
- package/lib/util/behavior.js.map +1 -1
- package/lib/util/data.d.ts +2 -2
- package/lib/util/data.js.map +1 -1
- package/lib/util/dom.d.ts +15 -0
- package/lib/util/dom.js +34 -0
- package/lib/util/dom.js.map +1 -0
- package/lib/util/event.d.ts +5 -3
- package/lib/util/event.js +8 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/extend.d.ts +1 -1
- package/lib/util/extend.js +0 -1
- package/lib/util/extend.js.map +1 -1
- package/lib/util/index.d.ts +7 -52
- package/lib/util/index.js +23 -23
- package/lib/util/index.js.map +1 -1
- package/lib/util/item.d.ts +16 -1
- package/lib/util/item.js +33 -9
- package/lib/util/item.js.map +1 -1
- package/lib/util/layout.d.ts +13 -2
- package/lib/util/layout.js +47 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/loop.d.ts +1 -1
- package/lib/util/loop.js +4 -0
- package/lib/util/loop.js.map +1 -1
- package/lib/util/math.d.ts +1 -1
- package/lib/util/matrix.d.ts +6 -0
- package/lib/util/matrix.js +52 -0
- package/lib/util/matrix.js.map +1 -0
- package/lib/util/path.js +2 -2
- package/lib/util/path.js.map +1 -1
- package/lib/util/point.d.ts +1 -1
- package/lib/util/point.js +9 -2
- package/lib/util/point.js.map +1 -1
- package/lib/util/polyline.d.ts +2 -1
- package/lib/util/polyline.js +2 -1
- package/lib/util/polyline.js.map +1 -1
- package/lib/util/router.d.ts +1 -1
- package/lib/util/shape.d.ts +1 -2
- package/lib/util/shape.js +16 -26
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.js +15 -16
- package/lib/util/shape3d.js.map +1 -1
- package/lib/util/text.d.ts +1 -1
- package/lib/util/text.js +3 -2
- package/lib/util/text.js.map +1 -1
- package/lib/util/warn.d.ts +14 -0
- package/lib/util/warn.js +8 -0
- package/lib/util/warn.js.map +1 -0
- package/package.json +41 -50
- package/src/api-doc/graph.ts +4 -3
- package/src/api-doc/types.ts +1 -0
- package/src/constant/shape.ts +1 -1
- package/src/index.ts +5 -6
- package/src/item/combo.ts +16 -15
- package/src/item/edge.ts +135 -57
- package/src/item/item.ts +32 -19
- package/src/item/node.ts +36 -50
- package/src/runtime/controller/data.ts +140 -339
- package/src/runtime/controller/interaction.ts +10 -4
- package/src/runtime/controller/item.ts +261 -78
- package/src/runtime/controller/layout.ts +1 -5
- package/src/runtime/controller/plugin.ts +15 -4
- package/src/runtime/graph.ts +605 -103
- package/src/stdlib/behavior/activate-relations.ts +2 -2
- package/src/stdlib/behavior/brush-select.ts +14 -13
- package/src/stdlib/behavior/click-select.ts +1 -1
- package/src/stdlib/behavior/create-edge.ts +305 -0
- package/src/stdlib/behavior/drag-canvas.ts +107 -35
- package/src/stdlib/behavior/drag-combo.ts +10 -10
- package/src/stdlib/behavior/drag-node.ts +27 -18
- package/src/stdlib/behavior/index.ts +3 -0
- package/src/stdlib/behavior/lasso-select.ts +7 -5
- package/src/stdlib/behavior/scroll-canvas.ts +348 -0
- package/src/stdlib/behavior/shortcuts-call.ts +129 -0
- package/src/stdlib/behavior/zoom-canvas-3d.ts +4 -1
- package/src/stdlib/behavior/zoom-canvas.ts +98 -27
- package/src/stdlib/data/mapNodeSize.ts +2 -2
- package/src/stdlib/data/transformV4Data.ts +2 -2
- package/src/stdlib/data/validateData.ts +16 -16
- package/src/stdlib/index.ts +28 -7
- package/src/stdlib/item/edge/base.ts +32 -41
- package/src/stdlib/item/edge/cubic-horizontal.ts +0 -1
- package/src/stdlib/item/edge/cubic-vertical.ts +0 -1
- package/src/stdlib/item/edge/cubic.ts +1 -1
- package/src/stdlib/item/edge/loop.ts +1 -1
- package/src/stdlib/item/node/base.ts +38 -65
- package/src/stdlib/item/node/base3d.ts +1 -0
- package/src/stdlib/item/node/cube.ts +102 -0
- package/src/stdlib/item/node/diamond.ts +1 -1
- package/src/stdlib/item/node/ellipse.ts +2 -2
- package/src/stdlib/item/node/hexagon.ts +6 -2
- package/src/stdlib/item/node/image.ts +190 -0
- package/src/stdlib/item/node/index.ts +4 -0
- package/src/stdlib/plugin/edgeFilterLens/index.ts +387 -0
- package/src/stdlib/plugin/grid/index.ts +6 -6
- package/src/stdlib/plugin/history/combo-command.ts +2 -2
- package/src/stdlib/plugin/history/index.ts +14 -14
- package/src/stdlib/plugin/history/item-data-command.ts +35 -17
- package/src/stdlib/plugin/history/layer-updated-command.ts +2 -2
- package/src/stdlib/plugin/history/state-updated-command.ts +1 -1
- package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
- package/src/stdlib/plugin/hull/convexHull.ts +1 -1
- package/src/stdlib/plugin/hull/hullComponent.ts +10 -8
- package/src/stdlib/plugin/hull/util.ts +6 -2
- package/src/stdlib/plugin/index.ts +2 -0
- package/src/stdlib/plugin/legend/index.ts +6 -6
- package/src/stdlib/plugin/menu/index.ts +13 -13
- package/src/stdlib/plugin/minimap/index.ts +126 -16
- package/src/stdlib/plugin/snapline/index.ts +1297 -0
- package/src/stdlib/plugin/timebar/index.ts +4 -4
- package/src/stdlib/plugin/toolbar/index.ts +8 -8
- package/src/stdlib/plugin/tooltip/index.ts +10 -10
- package/src/stdlib/plugin/types.ts +2 -0
- package/src/stdlib/plugin/watermaker/index.ts +302 -0
- package/src/stdlib/theme/dark.ts +66 -2
- package/src/stdlib/theme/light.ts +4 -4
- package/src/types/event.ts +1 -0
- package/src/types/graph.ts +62 -25
- package/src/types/hook.ts +22 -2
- package/src/types/index.ts +2 -1
- package/src/types/item.ts +10 -0
- package/src/types/plugin.ts +1 -1
- package/src/types/spec.ts +22 -3
- package/src/types/view.ts +8 -3
- package/src/util/bbox.ts +42 -6
- package/src/util/behavior.ts +4 -4
- package/src/util/data.ts +2 -3
- package/src/util/dom.ts +33 -0
- package/src/util/event.ts +14 -1
- package/src/util/extend.ts +2 -3
- package/src/util/index.ts +7 -24
- package/src/util/item.ts +65 -28
- package/src/util/layout.ts +48 -2
- package/src/util/loop.ts +5 -1
- package/src/util/math.ts +1 -1
- package/src/util/matrix.ts +66 -0
- package/src/util/path.ts +1 -1
- package/src/util/point.ts +9 -4
- package/src/util/polyline.ts +2 -1
- package/src/util/router.ts +1 -1
- package/src/util/shape.ts +22 -26
- package/src/util/shape3d.ts +20 -20
- package/src/util/text.ts +3 -1
- package/src/util/warn.ts +20 -0
package/src/util/item.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ID } from '@antv/graphlib';
|
|
2
2
|
import { Group } from '@antv/g';
|
|
3
|
+
import { uniqueId } from '@antv/util';
|
|
3
4
|
import { IGraph } from '../types';
|
|
4
5
|
import Combo from '../item/combo';
|
|
5
6
|
import Edge from '../item/edge';
|
|
@@ -34,43 +35,62 @@ export const upsertTransientItem = (
|
|
|
34
35
|
transientItemMap: Map<ID, Node | Edge | Combo | Group>,
|
|
35
36
|
itemMap: Map<ID, Node | Edge | Combo>,
|
|
36
37
|
graphCore?: GraphCore,
|
|
37
|
-
|
|
38
|
+
drawOptions: {
|
|
39
|
+
shapeIds?: string[];
|
|
40
|
+
/** For transient edge */
|
|
41
|
+
drawSource?: boolean;
|
|
42
|
+
/** For transient edge */
|
|
43
|
+
drawTarget?: boolean;
|
|
44
|
+
visible?: boolean;
|
|
45
|
+
} = {},
|
|
38
46
|
upsertAncestors = true,
|
|
39
47
|
) => {
|
|
40
48
|
let transientItem = transientItemMap.get(item.model.id);
|
|
41
49
|
if (transientItem) {
|
|
42
50
|
return transientItem;
|
|
43
51
|
}
|
|
52
|
+
const {
|
|
53
|
+
shapeIds,
|
|
54
|
+
drawSource = true,
|
|
55
|
+
drawTarget = true,
|
|
56
|
+
visible = true,
|
|
57
|
+
} = drawOptions;
|
|
44
58
|
if (item.type === 'node') {
|
|
45
|
-
transientItem = item.clone(nodeGroup,
|
|
59
|
+
transientItem = item.clone(nodeGroup, shapeIds, true);
|
|
46
60
|
} else if (item.type === 'edge') {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
let source;
|
|
62
|
+
let target;
|
|
63
|
+
if (drawSource) {
|
|
64
|
+
source = upsertTransientItem(
|
|
65
|
+
item.sourceItem,
|
|
66
|
+
nodeGroup,
|
|
67
|
+
edgeGroup,
|
|
68
|
+
comboGroup,
|
|
69
|
+
transientItemMap,
|
|
70
|
+
itemMap,
|
|
71
|
+
graphCore,
|
|
72
|
+
drawOptions,
|
|
73
|
+
false,
|
|
74
|
+
) as Node | Combo;
|
|
75
|
+
}
|
|
76
|
+
if (drawTarget) {
|
|
77
|
+
target = upsertTransientItem(
|
|
78
|
+
item.targetItem,
|
|
79
|
+
nodeGroup,
|
|
80
|
+
edgeGroup,
|
|
81
|
+
comboGroup,
|
|
82
|
+
transientItemMap,
|
|
83
|
+
itemMap,
|
|
84
|
+
graphCore,
|
|
85
|
+
drawOptions,
|
|
86
|
+
false,
|
|
87
|
+
) as Node | Combo;
|
|
88
|
+
}
|
|
69
89
|
transientItem = item.clone(
|
|
70
90
|
edgeGroup,
|
|
71
91
|
source,
|
|
72
92
|
target,
|
|
73
|
-
|
|
93
|
+
shapeIds,
|
|
74
94
|
true,
|
|
75
95
|
) as Edge;
|
|
76
96
|
} else {
|
|
@@ -89,7 +109,7 @@ export const upsertTransientItem = (
|
|
|
89
109
|
transientItemMap,
|
|
90
110
|
itemMap,
|
|
91
111
|
graphCore,
|
|
92
|
-
|
|
112
|
+
drawOptions,
|
|
93
113
|
false,
|
|
94
114
|
),
|
|
95
115
|
);
|
|
@@ -97,7 +117,7 @@ export const upsertTransientItem = (
|
|
|
97
117
|
});
|
|
98
118
|
transientItem = (item as Combo).clone(
|
|
99
119
|
comboGroup,
|
|
100
|
-
|
|
120
|
+
shapeIds,
|
|
101
121
|
true,
|
|
102
122
|
() => getCombinedBoundsByItem(childItems), // getCombinedBounds
|
|
103
123
|
() => childItems,
|
|
@@ -105,6 +125,7 @@ export const upsertTransientItem = (
|
|
|
105
125
|
transientItem.toBack();
|
|
106
126
|
}
|
|
107
127
|
transientItemMap.set(item.model.id, transientItem);
|
|
128
|
+
// @ts-ignore
|
|
108
129
|
transientItem.transient = true;
|
|
109
130
|
|
|
110
131
|
if (
|
|
@@ -125,12 +146,28 @@ export const upsertTransientItem = (
|
|
|
125
146
|
transientItemMap,
|
|
126
147
|
itemMap,
|
|
127
148
|
graphCore,
|
|
128
|
-
|
|
149
|
+
drawOptions,
|
|
129
150
|
);
|
|
130
151
|
transientAncestor.toBack();
|
|
131
152
|
}
|
|
132
153
|
currentAncestor = graphCore.getParent(currentAncestor.id, 'combo');
|
|
133
154
|
}
|
|
134
155
|
}
|
|
156
|
+
|
|
157
|
+
if (shapeIds?.length && visible) {
|
|
158
|
+
// @ts-ignore
|
|
159
|
+
(transientItem as Group).childNodes.forEach((shape) => shape.show());
|
|
160
|
+
}
|
|
135
161
|
return transientItem;
|
|
136
162
|
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* generate unique edge id
|
|
166
|
+
* @todo consider edges with same source and target
|
|
167
|
+
* @param source
|
|
168
|
+
* @param target
|
|
169
|
+
* @returns
|
|
170
|
+
*/
|
|
171
|
+
export function generateEdgeID(source: ID, target: ID) {
|
|
172
|
+
return [source, uniqueId(), target].join('->');
|
|
173
|
+
}
|
package/src/util/layout.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import Hierarchy from '@antv/hierarchy';
|
|
2
|
-
|
|
3
2
|
import { isArray, isNumber } from '@antv/util';
|
|
4
|
-
import { GraphData, ID, NodeModel } from 'types';
|
|
3
|
+
import { GraphData, ID, NodeModel } from '../types';
|
|
5
4
|
import { Point } from '../types/common';
|
|
6
5
|
import { traverse } from './data';
|
|
6
|
+
|
|
7
7
|
type TreeGraphData = any;
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* Judge the direction according to options of a tree layout.
|
|
10
11
|
* @param type Tree layout type.
|
|
@@ -163,3 +164,48 @@ export const radialLayout = (
|
|
|
163
164
|
});
|
|
164
165
|
return;
|
|
165
166
|
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get the layout (nodes' positions) bounds of a graph.
|
|
170
|
+
* @param {Graph} graph - The graph object.
|
|
171
|
+
* @returns {Object} - The layout bounds object containing the minimum, maximum, center, and halfExtents values.
|
|
172
|
+
*/
|
|
173
|
+
export const getLayoutBounds = (graph) => {
|
|
174
|
+
const min = [Infinity, Infinity];
|
|
175
|
+
const max = [-Infinity, -Infinity];
|
|
176
|
+
const borderIds = { min: [], max: [] };
|
|
177
|
+
graph.getAllNodesData().forEach((model) => {
|
|
178
|
+
const { x, y } = model.data;
|
|
179
|
+
if (isNaN(x) || isNaN(y)) return;
|
|
180
|
+
if (min[0] > x) {
|
|
181
|
+
min[0] = x;
|
|
182
|
+
borderIds.min[0] = model.id;
|
|
183
|
+
}
|
|
184
|
+
if (min[1] > y) {
|
|
185
|
+
min[1] = y;
|
|
186
|
+
borderIds.min[1] = model.id;
|
|
187
|
+
}
|
|
188
|
+
if (max[0] < x) {
|
|
189
|
+
max[0] = x;
|
|
190
|
+
borderIds.max[0] = model.id;
|
|
191
|
+
}
|
|
192
|
+
if (max[1] < y) {
|
|
193
|
+
max[1] = y;
|
|
194
|
+
borderIds.max[1] = model.id;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
borderIds.min.forEach((id, i) => {
|
|
198
|
+
const { halfExtents: nodeHalfSize } = graph.getRenderBBox(id);
|
|
199
|
+
min[i] -= nodeHalfSize[i];
|
|
200
|
+
});
|
|
201
|
+
borderIds.max.forEach((id, i) => {
|
|
202
|
+
const { halfExtents: nodeHalfSize } = graph.getRenderBBox(id);
|
|
203
|
+
max[i] += nodeHalfSize[i];
|
|
204
|
+
});
|
|
205
|
+
return {
|
|
206
|
+
min,
|
|
207
|
+
max,
|
|
208
|
+
center: min.map((val, i) => (max[i] + val) / 2),
|
|
209
|
+
halfExtents: min.map((val, i) => (max[i] - val) / 2),
|
|
210
|
+
};
|
|
211
|
+
};
|
package/src/util/loop.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tuple3Number } from '@antv/g';
|
|
2
|
-
import { vec2 } from '
|
|
2
|
+
import { vec2 } from 'gl-matrix';
|
|
3
3
|
import { LOOP_POSITION, LoopPosition } from '../types/loop';
|
|
4
4
|
|
|
5
5
|
const PI_OVER_8 = Math.PI / 8;
|
|
@@ -69,6 +69,7 @@ export const calculatePointForOtherShapes = (
|
|
|
69
69
|
[center[0] - pointPadding, center[1] - halfOfHeight],
|
|
70
70
|
[center[0] + pointPadding, center[1] - halfOfHeight],
|
|
71
71
|
],
|
|
72
|
+
// @ts-ignore
|
|
72
73
|
[LOOP_POSITION['top-right']]: [
|
|
73
74
|
[center[0] + halfOfWidth - pointPadding, center[1] - halfOfHeight],
|
|
74
75
|
[center[0] + halfOfWidth, center[1] - halfOfHeight + pointPadding],
|
|
@@ -77,6 +78,7 @@ export const calculatePointForOtherShapes = (
|
|
|
77
78
|
[center[0] + halfOfWidth, center[1] - pointPadding],
|
|
78
79
|
[center[0] + halfOfWidth, center[1] + pointPadding],
|
|
79
80
|
],
|
|
81
|
+
// @ts-ignore
|
|
80
82
|
[LOOP_POSITION['bottom-right']]: [
|
|
81
83
|
[center[0] + halfOfWidth, center[1] + halfOfHeight - pointPadding],
|
|
82
84
|
[center[0] + halfOfWidth - pointPadding, center[1] + halfOfHeight],
|
|
@@ -85,6 +87,7 @@ export const calculatePointForOtherShapes = (
|
|
|
85
87
|
[center[0] + pointPadding, center[1] + halfOfHeight],
|
|
86
88
|
[center[0] - pointPadding, center[1] + halfOfHeight],
|
|
87
89
|
],
|
|
90
|
+
// @ts-ignore
|
|
88
91
|
[LOOP_POSITION['bottom-left']]: [
|
|
89
92
|
[center[0] - halfOfWidth + pointPadding, center[1] + halfOfHeight],
|
|
90
93
|
[center[0] - halfOfWidth, center[1] + halfOfHeight - pointPadding],
|
|
@@ -93,6 +96,7 @@ export const calculatePointForOtherShapes = (
|
|
|
93
96
|
[center[0] - halfOfWidth, center[1] + pointPadding],
|
|
94
97
|
[center[0] - halfOfWidth, center[1] - pointPadding],
|
|
95
98
|
],
|
|
99
|
+
// @ts-ignore
|
|
96
100
|
[LOOP_POSITION['top-left']]: [
|
|
97
101
|
[center[0] - halfOfWidth, center[1] - halfOfHeight + pointPadding],
|
|
98
102
|
[center[0] - halfOfWidth + pointPadding, center[1] - halfOfHeight],
|
package/src/util/math.ts
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { mat3 } from 'gl-matrix';
|
|
2
|
+
|
|
3
|
+
type mat3Type = [
|
|
4
|
+
number,
|
|
5
|
+
number,
|
|
6
|
+
number,
|
|
7
|
+
number,
|
|
8
|
+
number,
|
|
9
|
+
number,
|
|
10
|
+
number,
|
|
11
|
+
number,
|
|
12
|
+
number,
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
function leftTranslate(out, a, v) {
|
|
16
|
+
const transMat: mat3Type = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
17
|
+
mat3.fromTranslation(transMat, v);
|
|
18
|
+
return mat3.multiply(out, transMat, a);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function leftRotate(out, a, rad) {
|
|
22
|
+
const rotateMat: mat3Type = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
23
|
+
mat3.fromRotation(rotateMat, rad);
|
|
24
|
+
return mat3.multiply(out, rotateMat, a);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function leftScale(out, a, v) {
|
|
28
|
+
const scaleMat: mat3Type = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
29
|
+
mat3.fromScaling(scaleMat, v);
|
|
30
|
+
return mat3.multiply(out, scaleMat, a);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function leftMultiply(out, a, a1) {
|
|
34
|
+
return mat3.multiply(out, a1, a);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 根据 actions 来做 transform
|
|
39
|
+
* @param m
|
|
40
|
+
* @param actions
|
|
41
|
+
*/
|
|
42
|
+
export function transform(m: number[], actions: any[][]) {
|
|
43
|
+
const matrix = m ? [].concat(m) : [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
44
|
+
|
|
45
|
+
for (let i = 0, len = actions.length; i < len; i++) {
|
|
46
|
+
const action = actions[i];
|
|
47
|
+
switch (action[0]) {
|
|
48
|
+
case 't':
|
|
49
|
+
leftTranslate(matrix, matrix, [action[1], action[2]]);
|
|
50
|
+
break;
|
|
51
|
+
case 's':
|
|
52
|
+
leftScale(matrix, matrix, [action[1], action[2]]);
|
|
53
|
+
break;
|
|
54
|
+
case 'r':
|
|
55
|
+
leftRotate(matrix, matrix, action[1]);
|
|
56
|
+
break;
|
|
57
|
+
case 'm':
|
|
58
|
+
leftMultiply(matrix, matrix, action[1]);
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return matrix;
|
|
66
|
+
}
|
package/src/util/path.ts
CHANGED
package/src/util/point.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { vec2 } from '
|
|
1
|
+
import { vec2 } from 'gl-matrix';
|
|
2
2
|
import { Point } from '../types/common';
|
|
3
3
|
import { isBetween } from './math';
|
|
4
4
|
|
|
@@ -52,7 +52,10 @@ export const distanceVec = (p1: vec2, p2: vec2): number => {
|
|
|
52
52
|
export const distance = (p1: Point, p2: Point): number => {
|
|
53
53
|
const vx = p1.x - p2.x;
|
|
54
54
|
const vy = p1.y - p2.y;
|
|
55
|
-
|
|
55
|
+
const vz = p1.z - p2.z;
|
|
56
|
+
return isNaN(vz)
|
|
57
|
+
? Math.sqrt(vx * vx + vy * vy)
|
|
58
|
+
: Math.sqrt(vx * vx + vy * vy + vz * vz);
|
|
56
59
|
};
|
|
57
60
|
|
|
58
61
|
/**
|
|
@@ -61,8 +64,10 @@ export const distance = (p1: Point, p2: Point): number => {
|
|
|
61
64
|
* @param p2
|
|
62
65
|
* @returns
|
|
63
66
|
*/
|
|
64
|
-
export const isSamePoint = (p1: Point, p2: Point): boolean =>
|
|
65
|
-
|
|
67
|
+
export const isSamePoint = (p1: Point, p2: Point): boolean => {
|
|
68
|
+
if (!p1 || !p2) return false;
|
|
69
|
+
return p1.x === p2.x && p1.y === p2.y && p1.z === p2.z;
|
|
70
|
+
};
|
|
66
71
|
|
|
67
72
|
/**
|
|
68
73
|
* Get point and circle intersect point.
|
package/src/util/polyline.ts
CHANGED
|
@@ -55,7 +55,8 @@ export const simplifyPolylinePoints = (points: PolyPoint[]): PolyPoint[] => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Use the A* path-finding algorithm to obtain the shortest path.
|
|
58
|
+
* Use the A* path-finding algorithm to obtain the shortest path.
|
|
59
|
+
* Considering that there is no need to implement automatic obstacle avoidance, use waypoints to plan the path.
|
|
59
60
|
*/
|
|
60
61
|
export const simplePathFinder = (
|
|
61
62
|
start: PolyPoint,
|
package/src/util/router.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface RouterCfg {
|
|
|
24
24
|
/** Allowed edge directions */
|
|
25
25
|
directions?: any[];
|
|
26
26
|
/** Penalties */
|
|
27
|
-
penalties?:
|
|
27
|
+
penalties?: Record<string, any>;
|
|
28
28
|
/** Determine if use simple router for polyline when no obstacles */
|
|
29
29
|
simple?: boolean;
|
|
30
30
|
/** Function to calculate the distance between two points */
|
package/src/util/shape.ts
CHANGED
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
ItemShapeStyles,
|
|
25
25
|
ShapeStyle,
|
|
26
26
|
SHAPE_TYPE_3D,
|
|
27
|
-
ItemModel,
|
|
28
27
|
} from '../types/item';
|
|
29
28
|
import { NodeDisplayModel, NodeShapeMap } from '../types/node';
|
|
30
29
|
import { ComboDisplayModel, IGraph } from '../types';
|
|
@@ -49,8 +48,6 @@ export const ShapeTagMap = {
|
|
|
49
48
|
|
|
50
49
|
const LINE_TYPES = ['line', 'polyline', 'path'];
|
|
51
50
|
|
|
52
|
-
export const LOCAL_BOUNDS_DIRTY_FLAG_KEY = 'data-item-local-bounds-dirty';
|
|
53
|
-
|
|
54
51
|
export const createShape = (
|
|
55
52
|
type: SHAPE_TYPE,
|
|
56
53
|
style: GShapeStyle,
|
|
@@ -133,12 +130,10 @@ export const upsertShape = (
|
|
|
133
130
|
shape.style[key] = initShapeStyles[key];
|
|
134
131
|
});
|
|
135
132
|
}
|
|
136
|
-
shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, true);
|
|
137
133
|
} else if (shape.nodeName !== type) {
|
|
138
134
|
// remove and create for the shape changed type
|
|
139
135
|
shape.remove();
|
|
140
136
|
shape = createShape(type, style, id);
|
|
141
|
-
shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, true);
|
|
142
137
|
} else {
|
|
143
138
|
const updateStyles = {};
|
|
144
139
|
const oldStyles = shape.attributes;
|
|
@@ -163,9 +158,6 @@ export const upsertShape = (
|
|
|
163
158
|
}
|
|
164
159
|
});
|
|
165
160
|
}
|
|
166
|
-
if (isStyleAffectBBox(type, updateStyles)) {
|
|
167
|
-
shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, true);
|
|
168
|
-
}
|
|
169
161
|
if (style.interactive === false) shape.interactive = false;
|
|
170
162
|
else shape.interactive = true;
|
|
171
163
|
}
|
|
@@ -212,22 +204,27 @@ export const updateShapes = (
|
|
|
212
204
|
const prevShape = prevShapeMap[id];
|
|
213
205
|
const newShape = newShapeMap[id];
|
|
214
206
|
if (newShape && !shouldUpdate(id)) return;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (prevShape !== newShape) {
|
|
207
|
+
|
|
208
|
+
if (newShape) {
|
|
209
|
+
// Remove dirty shape first.
|
|
210
|
+
if (prevShape && prevShape !== newShape) {
|
|
219
211
|
prevShape.remove();
|
|
220
212
|
}
|
|
221
|
-
if (newShape.style.display !== 'none') {
|
|
222
|
-
group.appendChild(newShape);
|
|
223
|
-
}
|
|
224
|
-
} else if (!prevShape && newShape) {
|
|
225
|
-
// add newShapeMap - prevShapeMap
|
|
226
213
|
finalShapeMap[id] = newShape;
|
|
227
|
-
if (
|
|
214
|
+
if (
|
|
215
|
+
// NewShape is already in the group, no need to reappend.
|
|
216
|
+
// Note: If the given child is a reference to an existing node in the document,
|
|
217
|
+
// appendChild() moves it from its current position to the new position.
|
|
218
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
|
|
219
|
+
newShape.parentElement !== group &&
|
|
220
|
+
!newShape.destroyed &&
|
|
221
|
+
newShape.style.display !== 'none'
|
|
222
|
+
) {
|
|
228
223
|
group.appendChild(newShape);
|
|
229
224
|
}
|
|
230
|
-
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (prevShape && !newShape && removeDiff) {
|
|
231
228
|
// remove prevShapeMap - newShapeMap
|
|
232
229
|
delete finalShapeMap[id];
|
|
233
230
|
prevShape.remove();
|
|
@@ -270,7 +267,7 @@ export const formatPadding = (
|
|
|
270
267
|
* @returns
|
|
271
268
|
*/
|
|
272
269
|
export const mergeStyles = (styleMaps: ItemShapeStyles[]) => {
|
|
273
|
-
let currentResult = styleMaps[0];
|
|
270
|
+
let currentResult = clone(styleMaps[0]);
|
|
274
271
|
styleMaps.forEach((styleMap, i) => {
|
|
275
272
|
if (i > 0) currentResult = merge2Styles(currentResult, styleMap);
|
|
276
273
|
});
|
|
@@ -289,15 +286,14 @@ const merge2Styles = (
|
|
|
289
286
|
) => {
|
|
290
287
|
if (!styleMap1) return { ...styleMap2 };
|
|
291
288
|
else if (!styleMap2) return { ...styleMap1 };
|
|
292
|
-
const mergedStyle =
|
|
289
|
+
const mergedStyle = styleMap1;
|
|
293
290
|
Object.keys(styleMap2).forEach((shapeId) => {
|
|
294
291
|
const style = styleMap2[shapeId];
|
|
295
|
-
mergedStyle[shapeId] = mergedStyle[shapeId] || {};
|
|
296
292
|
if (!style) return;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
293
|
+
mergedStyle[shapeId] = {
|
|
294
|
+
...mergedStyle[shapeId],
|
|
295
|
+
...style,
|
|
296
|
+
};
|
|
301
297
|
});
|
|
302
298
|
return mergedStyle;
|
|
303
299
|
};
|
package/src/util/shape3d.ts
CHANGED
|
@@ -11,15 +11,11 @@ import {
|
|
|
11
11
|
import { EdgeShapeMap } from '../types/edge';
|
|
12
12
|
import { NodeShapeMap } from '../types/node';
|
|
13
13
|
import { GShapeStyle, SHAPE_TYPE, SHAPE_TYPE_3D } from '../types/item';
|
|
14
|
-
import {
|
|
15
|
-
LOCAL_BOUNDS_DIRTY_FLAG_KEY,
|
|
16
|
-
createShape,
|
|
17
|
-
isStyleAffectBBox,
|
|
18
|
-
} from './shape';
|
|
14
|
+
import { createShape } from './shape';
|
|
19
15
|
|
|
20
16
|
const GeometryTagMap = {
|
|
21
17
|
sphere: SphereGeometry,
|
|
22
|
-
|
|
18
|
+
cube: CubeGeometry,
|
|
23
19
|
plane: PlaneGeometry,
|
|
24
20
|
};
|
|
25
21
|
|
|
@@ -132,12 +128,10 @@ export const upsertShape3D = (
|
|
|
132
128
|
if (!shape) {
|
|
133
129
|
// @ts-ignore
|
|
134
130
|
shape = createShape3D(type, style, id, device);
|
|
135
|
-
shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, true);
|
|
136
131
|
} else if (shape.nodeName !== type) {
|
|
137
132
|
shape.remove();
|
|
138
133
|
// @ts-ignore
|
|
139
134
|
shape = createShape3D(type, style, id, device);
|
|
140
|
-
shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, true);
|
|
141
135
|
} else {
|
|
142
136
|
const updateStyles = {};
|
|
143
137
|
const oldStyles = shape.attributes;
|
|
@@ -147,9 +141,6 @@ export const upsertShape3D = (
|
|
|
147
141
|
shape.style[key] = style[key];
|
|
148
142
|
}
|
|
149
143
|
});
|
|
150
|
-
if (isStyleAffectBBox(type, updateStyles)) {
|
|
151
|
-
shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, true);
|
|
152
|
-
}
|
|
153
144
|
}
|
|
154
145
|
shapeMap[id] = shape;
|
|
155
146
|
return shape;
|
|
@@ -182,18 +173,27 @@ export const updateShapes3D = (
|
|
|
182
173
|
const prevShape = prevShapeMap[id];
|
|
183
174
|
const newShape = newShapeMap[id];
|
|
184
175
|
if (newShape && !shouldUpdate(id)) return;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (prevShape !== newShape) {
|
|
176
|
+
|
|
177
|
+
if (newShape) {
|
|
178
|
+
// Remove dirty shape first.
|
|
179
|
+
if (prevShape && prevShape !== newShape) {
|
|
189
180
|
prevShape.remove();
|
|
190
181
|
}
|
|
191
|
-
group.appendChild(newShape);
|
|
192
|
-
} else if (!prevShape && newShape) {
|
|
193
|
-
// add newShapeMap - prevShapeMap
|
|
194
182
|
finalShapeMap[id] = newShape;
|
|
195
|
-
|
|
196
|
-
|
|
183
|
+
if (
|
|
184
|
+
// NewShape is already in the group, no need to reappend.
|
|
185
|
+
// Note: If the given child is a reference to an existing node in the document,
|
|
186
|
+
// appendChild() moves it from its current position to the new position.
|
|
187
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
|
|
188
|
+
newShape.parentElement !== group &&
|
|
189
|
+
!newShape.destroyed &&
|
|
190
|
+
newShape.style.display !== 'none'
|
|
191
|
+
) {
|
|
192
|
+
group.appendChild(newShape);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (prevShape && !newShape && removeDiff) {
|
|
197
197
|
// remove prevShapeMap - newShapeMap
|
|
198
198
|
delete finalShapeMap[id];
|
|
199
199
|
prevShape.remove();
|
package/src/util/text.ts
CHANGED
|
@@ -13,8 +13,10 @@ export const getWordWrapWidthByBox = (
|
|
|
13
13
|
keyShapeBox: AABB,
|
|
14
14
|
maxWidth: string | number,
|
|
15
15
|
zoom = 1,
|
|
16
|
+
enableBalanceShape = false,
|
|
16
17
|
) => {
|
|
17
|
-
const
|
|
18
|
+
const balanceZoom = enableBalanceShape ? zoom : 1;
|
|
19
|
+
const keyShapeWidth = (keyShapeBox.max[0] - keyShapeBox.min[0]) * balanceZoom;
|
|
18
20
|
return getWordWrapWidthWithBase(keyShapeWidth, maxWidth);
|
|
19
21
|
};
|
|
20
22
|
|
package/src/util/warn.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* optionName: 选项名
|
|
3
|
+
* shouldBe: 合法的输入参数
|
|
4
|
+
* now: 当前用户输入值
|
|
5
|
+
* scope: 选项所属的模块
|
|
6
|
+
*/
|
|
7
|
+
type WarnOption = {
|
|
8
|
+
optionName: string;
|
|
9
|
+
shouldBe: any;
|
|
10
|
+
now: string | number;
|
|
11
|
+
scope: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function warn({ optionName, shouldBe, now, scope }: WarnOption) {
|
|
15
|
+
console.warn(
|
|
16
|
+
`G6 [${scope}]: Invalid option, ${optionName} must be one of ${shouldBe.join(
|
|
17
|
+
', ',
|
|
18
|
+
)}, but got ${now}`,
|
|
19
|
+
);
|
|
20
|
+
}
|