@antv/g6 5.0.0-beta.32 → 5.0.0-beta.33
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/dist/lib/behaviors/brush-select.d.ts +104 -0
- package/dist/lib/behaviors/click-element.d.ts +77 -0
- package/dist/lib/behaviors/drag-element-force.d.ts +14 -0
- package/dist/lib/behaviors/drag-element.d.ts +13 -12
- package/dist/lib/behaviors/index.d.ts +8 -0
- package/dist/lib/behaviors/lasso-select.d.ts +20 -0
- package/dist/lib/behaviors/types.d.ts +1 -0
- package/dist/lib/constants/change.d.ts +1 -1
- package/dist/lib/constants/events/graph.d.ts +9 -7
- package/dist/lib/constants/registry.d.ts +3 -1
- package/dist/lib/elements/combos/base-combo.d.ts +43 -6
- package/dist/lib/elements/combos/circle.d.ts +8 -12
- package/dist/lib/elements/combos/rect.d.ts +5 -9
- package/dist/lib/elements/edges/base-edge.d.ts +64 -10
- package/dist/lib/elements/edges/cubic-horizontal.d.ts +2 -2
- package/dist/lib/elements/edges/cubic-vertical.d.ts +2 -2
- package/dist/lib/elements/edges/cubic.d.ts +2 -2
- package/dist/lib/elements/edges/polyline.d.ts +2 -2
- package/dist/lib/elements/edges/quadratic.d.ts +2 -2
- package/dist/lib/elements/nodes/base-node.d.ts +104 -13
- package/dist/lib/elements/nodes/circle.d.ts +5 -8
- package/dist/lib/elements/nodes/diamond.d.ts +2 -4
- package/dist/lib/elements/nodes/ellipse.d.ts +5 -8
- package/dist/lib/elements/nodes/hexagon.d.ts +6 -9
- package/dist/lib/elements/nodes/image.d.ts +9 -11
- package/dist/lib/elements/nodes/polygon.d.ts +9 -8
- package/dist/lib/elements/nodes/rect.d.ts +2 -3
- package/dist/lib/elements/nodes/star.d.ts +7 -10
- package/dist/lib/elements/nodes/triangle.d.ts +7 -10
- package/dist/lib/exports.d.ts +4 -2
- package/dist/lib/layouts/index.d.ts +1 -1
- package/dist/lib/layouts/types.d.ts +6 -6
- package/dist/lib/palettes/index.d.ts +1 -0
- package/dist/lib/plugins/history/events.d.ts +21 -0
- package/dist/lib/plugins/history/index.d.ts +82 -0
- package/dist/lib/plugins/history/utils.d.ts +31 -0
- package/dist/lib/plugins/hull/index.d.ts +59 -0
- package/dist/lib/plugins/hull/shape.d.ts +49 -0
- package/dist/lib/plugins/hull/util.d.ts +12 -0
- package/dist/lib/plugins/index.d.ts +4 -0
- package/dist/lib/registry/extension/index.d.ts +1 -1
- package/dist/lib/registry/types.d.ts +4 -0
- package/dist/lib/runtime/batch.d.ts +11 -0
- package/dist/lib/runtime/behavior.d.ts +1 -1
- package/dist/lib/runtime/canvas.d.ts +13 -3
- package/dist/lib/runtime/data.d.ts +4 -4
- package/dist/lib/runtime/element.d.ts +3 -19
- package/dist/lib/runtime/graph.d.ts +40 -2
- package/dist/lib/runtime/layout.d.ts +5 -11
- package/dist/lib/runtime/plugin.d.ts +1 -1
- package/dist/lib/runtime/transform.d.ts +11 -0
- package/dist/lib/runtime/types.d.ts +14 -0
- package/dist/lib/spec/index.d.ts +1 -0
- package/dist/lib/spec/spec.d.ts +7 -0
- package/dist/lib/spec/transform.d.ts +12 -0
- package/dist/lib/transforms/arrange-draw-order.d.ts +10 -0
- package/dist/lib/transforms/base-transform.d.ts +7 -0
- package/dist/lib/transforms/collapse-expand-combo.d.ts +10 -0
- package/dist/lib/transforms/index.d.ts +6 -0
- package/dist/lib/transforms/process-parallel-edges.d.ts +84 -0
- package/dist/lib/transforms/types.d.ts +20 -0
- package/dist/lib/transforms/update-related-edge.d.ts +9 -0
- package/dist/lib/types/canvas.d.ts +1 -1
- package/dist/lib/types/change.d.ts +27 -10
- package/dist/lib/types/element.d.ts +6 -140
- package/dist/lib/types/node.d.ts +3 -3
- package/dist/lib/types/point.d.ts +1 -0
- package/dist/lib/utils/animation.d.ts +1 -1
- package/dist/lib/utils/behaviors/brush.d.ts +19 -0
- package/dist/lib/utils/behaviors/lasso.d.ts +13 -0
- package/dist/lib/utils/behaviors/utils.d.ts +21 -0
- package/dist/lib/utils/change.d.ts +9 -1
- package/dist/lib/utils/combo.d.ts +5 -4
- package/dist/lib/utils/edge.d.ts +11 -0
- package/dist/lib/utils/event/events.d.ts +1 -1
- package/dist/lib/utils/extension.d.ts +1 -1
- package/dist/lib/utils/id.d.ts +3 -8
- package/dist/lib/utils/line.d.ts +21 -0
- package/dist/lib/utils/path.d.ts +35 -0
- package/dist/lib/utils/point.d.ts +74 -20
- package/dist/lib/utils/polygon.d.ts +17 -0
- package/dist/lib/utils/position.d.ts +14 -1
- package/dist/lib/utils/prefix.d.ts +1 -1
- package/dist/lib/utils/shortcut.d.ts +1 -0
- package/dist/lib/utils/vector.d.ts +3 -2
- package/esm/behaviors/brush-select.d.ts +104 -0
- package/esm/behaviors/brush-select.js +199 -0
- package/esm/behaviors/brush-select.js.map +1 -0
- package/esm/behaviors/click-element.d.ts +77 -0
- package/esm/behaviors/click-element.js +108 -0
- package/esm/behaviors/click-element.js.map +1 -0
- package/esm/behaviors/drag-element-force.d.ts +14 -0
- package/esm/behaviors/drag-element-force.js +55 -0
- package/esm/behaviors/drag-element-force.js.map +1 -0
- package/esm/behaviors/drag-element.d.ts +13 -12
- package/esm/behaviors/drag-element.js +17 -9
- package/esm/behaviors/drag-element.js.map +1 -1
- package/esm/behaviors/hover-element.js +2 -2
- package/esm/behaviors/hover-element.js.map +1 -1
- package/esm/behaviors/index.d.ts +8 -0
- package/esm/behaviors/index.js +4 -0
- package/esm/behaviors/index.js.map +1 -1
- package/esm/behaviors/lasso-select.d.ts +20 -0
- package/esm/behaviors/lasso-select.js +79 -0
- package/esm/behaviors/lasso-select.js.map +1 -0
- package/esm/behaviors/types.d.ts +1 -0
- package/esm/constants/change.d.ts +1 -1
- package/esm/constants/change.js +12 -12
- package/esm/constants/change.js.map +1 -1
- package/esm/constants/events/graph.d.ts +9 -7
- package/esm/constants/events/graph.js +8 -8
- package/esm/constants/events/graph.js.map +1 -1
- package/esm/constants/registry.d.ts +3 -1
- package/esm/constants/registry.js +2 -0
- package/esm/constants/registry.js.map +1 -1
- package/esm/elements/combos/base-combo.d.ts +43 -6
- package/esm/elements/combos/base-combo.js.map +1 -1
- package/esm/elements/combos/circle.d.ts +8 -12
- package/esm/elements/combos/circle.js.map +1 -1
- package/esm/elements/combos/rect.d.ts +5 -9
- package/esm/elements/combos/rect.js.map +1 -1
- package/esm/elements/edges/base-edge.d.ts +64 -10
- package/esm/elements/edges/base-edge.js.map +1 -1
- package/esm/elements/edges/cubic-horizontal.d.ts +2 -2
- package/esm/elements/edges/cubic-vertical.d.ts +2 -2
- package/esm/elements/edges/cubic.d.ts +2 -2
- package/esm/elements/edges/polyline.d.ts +2 -2
- package/esm/elements/edges/quadratic.d.ts +2 -2
- package/esm/elements/nodes/base-node.d.ts +104 -13
- package/esm/elements/nodes/base-node.js +4 -1
- package/esm/elements/nodes/base-node.js.map +1 -1
- package/esm/elements/nodes/circle.d.ts +5 -8
- package/esm/elements/nodes/circle.js.map +1 -1
- package/esm/elements/nodes/diamond.d.ts +2 -4
- package/esm/elements/nodes/diamond.js +2 -2
- package/esm/elements/nodes/diamond.js.map +1 -1
- package/esm/elements/nodes/ellipse.d.ts +5 -8
- package/esm/elements/nodes/ellipse.js +1 -1
- package/esm/elements/nodes/ellipse.js.map +1 -1
- package/esm/elements/nodes/hexagon.d.ts +6 -9
- package/esm/elements/nodes/hexagon.js.map +1 -1
- package/esm/elements/nodes/image.d.ts +9 -11
- package/esm/elements/nodes/image.js.map +1 -1
- package/esm/elements/nodes/polygon.d.ts +9 -8
- package/esm/elements/nodes/polygon.js +4 -1
- package/esm/elements/nodes/polygon.js.map +1 -1
- package/esm/elements/nodes/rect.d.ts +2 -3
- package/esm/elements/nodes/rect.js.map +1 -1
- package/esm/elements/nodes/star.d.ts +7 -10
- package/esm/elements/nodes/star.js.map +1 -1
- package/esm/elements/nodes/triangle.d.ts +7 -10
- package/esm/elements/nodes/triangle.js.map +1 -1
- package/esm/exports.d.ts +4 -2
- package/esm/exports.js +2 -1
- package/esm/exports.js.map +1 -1
- package/esm/layouts/index.d.ts +1 -1
- package/esm/layouts/index.js +1 -1
- package/esm/layouts/index.js.map +1 -1
- package/esm/layouts/types.d.ts +6 -6
- package/esm/palettes/index.d.ts +1 -0
- package/esm/palettes/index.js +12 -0
- package/esm/palettes/index.js.map +1 -1
- package/esm/plugins/history/events.d.ts +21 -0
- package/esm/plugins/history/events.js +16 -0
- package/esm/plugins/history/events.js.map +1 -0
- package/esm/plugins/history/index.d.ts +82 -0
- package/esm/plugins/history/index.js +168 -0
- package/esm/plugins/history/index.js.map +1 -0
- package/esm/plugins/history/utils.d.ts +31 -0
- package/esm/plugins/history/utils.js +79 -0
- package/esm/plugins/history/utils.js.map +1 -0
- package/esm/plugins/hull/index.d.ts +59 -0
- package/esm/plugins/hull/index.js +107 -0
- package/esm/plugins/hull/index.js.map +1 -0
- package/esm/plugins/hull/shape.d.ts +49 -0
- package/esm/plugins/hull/shape.js +35 -0
- package/esm/plugins/hull/shape.js.map +1 -0
- package/esm/plugins/hull/util.d.ts +12 -0
- package/esm/plugins/hull/util.js +203 -0
- package/esm/plugins/hull/util.js.map +1 -0
- package/esm/plugins/index.d.ts +4 -0
- package/esm/plugins/index.js +2 -0
- package/esm/plugins/index.js.map +1 -1
- package/esm/plugins/legend.js.map +1 -1
- package/esm/registry/build-in.js +19 -4
- package/esm/registry/build-in.js.map +1 -1
- package/esm/registry/extension/index.d.ts +1 -1
- package/esm/registry/index.js +1 -0
- package/esm/registry/index.js.map +1 -1
- package/esm/registry/types.d.ts +4 -0
- package/esm/runtime/batch.d.ts +11 -0
- package/esm/runtime/batch.js +31 -0
- package/esm/runtime/batch.js.map +1 -0
- package/esm/runtime/behavior.d.ts +1 -1
- package/esm/runtime/behavior.js.map +1 -1
- package/esm/runtime/canvas.d.ts +13 -3
- package/esm/runtime/canvas.js +36 -12
- package/esm/runtime/canvas.js.map +1 -1
- package/esm/runtime/data.d.ts +4 -4
- package/esm/runtime/data.js +23 -25
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +3 -19
- package/esm/runtime/element.js +16 -137
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +40 -2
- package/esm/runtime/graph.js +57 -1
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/layout.d.ts +5 -11
- package/esm/runtime/layout.js +29 -75
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/plugin.d.ts +1 -1
- package/esm/runtime/plugin.js.map +1 -1
- package/esm/runtime/transform.d.ts +11 -0
- package/esm/runtime/transform.js +20 -0
- package/esm/runtime/transform.js.map +1 -0
- package/esm/runtime/types.d.ts +14 -0
- package/esm/spec/index.d.ts +1 -0
- package/esm/spec/spec.d.ts +7 -0
- package/esm/spec/transform.d.ts +12 -0
- package/esm/spec/transform.js +2 -0
- package/esm/spec/transform.js.map +1 -0
- package/esm/themes/base.js +9 -1
- package/esm/themes/base.js.map +1 -1
- package/esm/transforms/arrange-draw-order.d.ts +10 -0
- package/esm/transforms/arrange-draw-order.js +27 -0
- package/esm/transforms/arrange-draw-order.js.map +1 -0
- package/esm/transforms/base-transform.d.ts +7 -0
- package/esm/transforms/base-transform.js +7 -0
- package/esm/transforms/base-transform.js.map +1 -0
- package/esm/transforms/collapse-expand-combo.d.ts +10 -0
- package/esm/transforms/collapse-expand-combo.js +82 -0
- package/esm/transforms/collapse-expand-combo.js.map +1 -0
- package/esm/transforms/index.d.ts +6 -0
- package/esm/transforms/index.js +6 -0
- package/esm/transforms/index.js.map +1 -0
- package/esm/transforms/process-parallel-edges.d.ts +84 -0
- package/esm/transforms/process-parallel-edges.js +215 -0
- package/esm/transforms/process-parallel-edges.js.map +1 -0
- package/esm/transforms/types.d.ts +20 -0
- package/esm/transforms/types.js +11 -0
- package/esm/transforms/types.js.map +1 -0
- package/esm/transforms/update-related-edge.d.ts +9 -0
- package/esm/transforms/update-related-edge.js +20 -0
- package/esm/transforms/update-related-edge.js.map +1 -0
- package/esm/types/canvas.d.ts +1 -1
- package/esm/types/change.d.ts +27 -10
- package/esm/types/element.d.ts +6 -140
- package/esm/types/node.d.ts +3 -3
- package/esm/types/point.d.ts +1 -0
- package/esm/utils/animation.d.ts +1 -1
- package/esm/utils/animation.js +6 -0
- package/esm/utils/animation.js.map +1 -1
- package/esm/utils/behaviors/brush.d.ts +19 -0
- package/esm/utils/behaviors/brush.js +25 -0
- package/esm/utils/behaviors/brush.js.map +1 -0
- package/esm/utils/behaviors/lasso.d.ts +13 -0
- package/esm/utils/behaviors/lasso.js +112 -0
- package/esm/utils/behaviors/lasso.js.map +1 -0
- package/esm/utils/behaviors/utils.d.ts +21 -0
- package/esm/utils/behaviors/utils.js +42 -0
- package/esm/utils/behaviors/utils.js.map +1 -0
- package/esm/utils/change.d.ts +9 -1
- package/esm/utils/change.js +28 -0
- package/esm/utils/change.js.map +1 -1
- package/esm/utils/combo.d.ts +5 -4
- package/esm/utils/combo.js.map +1 -1
- package/esm/utils/edge.d.ts +11 -0
- package/esm/utils/edge.js +1 -1
- package/esm/utils/edge.js.map +1 -1
- package/esm/utils/event/events.d.ts +1 -1
- package/esm/utils/event/events.js.map +1 -1
- package/esm/utils/extension.d.ts +1 -1
- package/esm/utils/extension.js.map +1 -1
- package/esm/utils/id.d.ts +3 -8
- package/esm/utils/id.js +8 -2
- package/esm/utils/id.js.map +1 -1
- package/esm/utils/line.d.ts +21 -0
- package/esm/utils/line.js +41 -0
- package/esm/utils/line.js.map +1 -0
- package/esm/utils/path.d.ts +35 -0
- package/esm/utils/path.js +143 -0
- package/esm/utils/path.js.map +1 -0
- package/esm/utils/point.d.ts +74 -20
- package/esm/utils/point.js +168 -44
- package/esm/utils/point.js.map +1 -1
- package/esm/utils/polygon.d.ts +17 -0
- package/esm/utils/polygon.js +62 -0
- package/esm/utils/polygon.js.map +1 -0
- package/esm/utils/position.d.ts +14 -1
- package/esm/utils/position.js +16 -0
- package/esm/utils/position.js.map +1 -1
- package/esm/utils/prefix.d.ts +1 -1
- package/esm/utils/prefix.js.map +1 -1
- package/esm/utils/shortcut.d.ts +1 -0
- package/esm/utils/shortcut.js +13 -2
- package/esm/utils/shortcut.js.map +1 -1
- package/esm/utils/style.js.map +1 -1
- package/esm/utils/vector.d.ts +3 -2
- package/esm/utils/vector.js +10 -3
- package/esm/utils/vector.js.map +1 -1
- package/lib/behaviors/brush-select.d.ts +104 -0
- package/lib/behaviors/brush-select.js +203 -0
- package/lib/behaviors/brush-select.js.map +1 -0
- package/lib/behaviors/click-element.d.ts +77 -0
- package/lib/behaviors/click-element.js +112 -0
- package/lib/behaviors/click-element.js.map +1 -0
- package/lib/behaviors/drag-element-force.d.ts +14 -0
- package/lib/behaviors/drag-element-force.js +59 -0
- package/lib/behaviors/drag-element-force.js.map +1 -0
- package/lib/behaviors/drag-element.d.ts +13 -12
- package/lib/behaviors/drag-element.js +17 -9
- package/lib/behaviors/drag-element.js.map +1 -1
- package/lib/behaviors/hover-element.js +1 -1
- package/lib/behaviors/hover-element.js.map +1 -1
- package/lib/behaviors/index.d.ts +8 -0
- package/lib/behaviors/index.js +9 -1
- package/lib/behaviors/index.js.map +1 -1
- package/lib/behaviors/lasso-select.d.ts +20 -0
- package/lib/behaviors/lasso-select.js +83 -0
- package/lib/behaviors/lasso-select.js.map +1 -0
- package/lib/behaviors/types.d.ts +1 -0
- package/lib/constants/change.d.ts +1 -1
- package/lib/constants/change.js +13 -13
- package/lib/constants/change.js.map +1 -1
- package/lib/constants/events/graph.d.ts +9 -7
- package/lib/constants/events/graph.js +9 -9
- package/lib/constants/events/graph.js.map +1 -1
- package/lib/constants/registry.d.ts +3 -1
- package/lib/constants/registry.js +2 -0
- package/lib/constants/registry.js.map +1 -1
- package/lib/elements/combos/base-combo.d.ts +43 -6
- package/lib/elements/combos/base-combo.js.map +1 -1
- package/lib/elements/combos/circle.d.ts +8 -12
- package/lib/elements/combos/circle.js.map +1 -1
- package/lib/elements/combos/rect.d.ts +5 -9
- package/lib/elements/combos/rect.js.map +1 -1
- package/lib/elements/edges/base-edge.d.ts +64 -10
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/edges/cubic-horizontal.d.ts +2 -2
- package/lib/elements/edges/cubic-vertical.d.ts +2 -2
- package/lib/elements/edges/cubic.d.ts +2 -2
- package/lib/elements/edges/polyline.d.ts +2 -2
- package/lib/elements/edges/quadratic.d.ts +2 -2
- package/lib/elements/nodes/base-node.d.ts +104 -13
- package/lib/elements/nodes/base-node.js +4 -1
- package/lib/elements/nodes/base-node.js.map +1 -1
- package/lib/elements/nodes/circle.d.ts +5 -8
- package/lib/elements/nodes/circle.js.map +1 -1
- package/lib/elements/nodes/diamond.d.ts +2 -4
- package/lib/elements/nodes/diamond.js +2 -2
- package/lib/elements/nodes/diamond.js.map +1 -1
- package/lib/elements/nodes/ellipse.d.ts +5 -8
- package/lib/elements/nodes/ellipse.js +1 -1
- package/lib/elements/nodes/ellipse.js.map +1 -1
- package/lib/elements/nodes/hexagon.d.ts +6 -9
- package/lib/elements/nodes/hexagon.js.map +1 -1
- package/lib/elements/nodes/image.d.ts +9 -11
- package/lib/elements/nodes/image.js.map +1 -1
- package/lib/elements/nodes/polygon.d.ts +9 -8
- package/lib/elements/nodes/polygon.js +4 -1
- package/lib/elements/nodes/polygon.js.map +1 -1
- package/lib/elements/nodes/rect.d.ts +2 -3
- package/lib/elements/nodes/rect.js.map +1 -1
- package/lib/elements/nodes/star.d.ts +7 -10
- package/lib/elements/nodes/star.js.map +1 -1
- package/lib/elements/nodes/triangle.d.ts +7 -10
- package/lib/elements/nodes/triangle.js.map +1 -1
- package/lib/exports.d.ts +4 -2
- package/lib/exports.js +4 -1
- package/lib/exports.js.map +1 -1
- package/lib/layouts/index.d.ts +1 -1
- package/lib/layouts/index.js +2 -1
- package/lib/layouts/index.js.map +1 -1
- package/lib/layouts/types.d.ts +6 -6
- package/lib/palettes/index.d.ts +1 -0
- package/lib/palettes/index.js +13 -1
- package/lib/palettes/index.js.map +1 -1
- package/lib/plugins/history/events.d.ts +21 -0
- package/lib/plugins/history/events.js +19 -0
- package/lib/plugins/history/events.js.map +1 -0
- package/lib/plugins/history/index.d.ts +82 -0
- package/lib/plugins/history/index.js +175 -0
- package/lib/plugins/history/index.js.map +1 -0
- package/lib/plugins/history/utils.d.ts +31 -0
- package/lib/plugins/history/utils.js +84 -0
- package/lib/plugins/history/utils.js.map +1 -0
- package/lib/plugins/hull/index.d.ts +59 -0
- package/lib/plugins/hull/index.js +114 -0
- package/lib/plugins/hull/index.js.map +1 -0
- package/lib/plugins/hull/shape.d.ts +49 -0
- package/lib/plugins/hull/shape.js +39 -0
- package/lib/plugins/hull/shape.js.map +1 -0
- package/lib/plugins/hull/util.d.ts +12 -0
- package/lib/plugins/hull/util.js +207 -0
- package/lib/plugins/hull/util.js.map +1 -0
- package/lib/plugins/index.d.ts +4 -0
- package/lib/plugins/index.js +5 -1
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/legend.js.map +1 -1
- package/lib/registry/build-in.js +15 -0
- package/lib/registry/build-in.js.map +1 -1
- package/lib/registry/extension/index.d.ts +1 -1
- package/lib/registry/index.js +1 -0
- package/lib/registry/index.js.map +1 -1
- package/lib/registry/types.d.ts +4 -0
- package/lib/runtime/batch.d.ts +11 -0
- package/lib/runtime/batch.js +35 -0
- package/lib/runtime/batch.js.map +1 -0
- package/lib/runtime/behavior.d.ts +1 -1
- package/lib/runtime/behavior.js.map +1 -1
- package/lib/runtime/canvas.d.ts +13 -3
- package/lib/runtime/canvas.js +34 -10
- package/lib/runtime/canvas.js.map +1 -1
- package/lib/runtime/data.d.ts +4 -4
- package/lib/runtime/data.js +22 -24
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +3 -19
- package/lib/runtime/element.js +16 -137
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +40 -2
- package/lib/runtime/graph.js +57 -1
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/layout.d.ts +5 -11
- package/lib/runtime/layout.js +27 -73
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/plugin.d.ts +1 -1
- package/lib/runtime/plugin.js.map +1 -1
- package/lib/runtime/transform.d.ts +11 -0
- package/lib/runtime/transform.js +24 -0
- package/lib/runtime/transform.js.map +1 -0
- package/lib/runtime/types.d.ts +14 -0
- package/lib/spec/index.d.ts +1 -0
- package/lib/spec/spec.d.ts +7 -0
- package/lib/spec/transform.d.ts +12 -0
- package/lib/spec/transform.js +3 -0
- package/lib/spec/transform.js.map +1 -0
- package/lib/themes/base.js +9 -1
- package/lib/themes/base.js.map +1 -1
- package/lib/transforms/arrange-draw-order.d.ts +10 -0
- package/lib/transforms/arrange-draw-order.js +31 -0
- package/lib/transforms/arrange-draw-order.js.map +1 -0
- package/lib/transforms/base-transform.d.ts +7 -0
- package/lib/transforms/base-transform.js +11 -0
- package/lib/transforms/base-transform.js.map +1 -0
- package/lib/transforms/collapse-expand-combo.d.ts +10 -0
- package/lib/transforms/collapse-expand-combo.js +86 -0
- package/lib/transforms/collapse-expand-combo.js.map +1 -0
- package/lib/transforms/index.d.ts +6 -0
- package/lib/transforms/index.js +14 -0
- package/lib/transforms/index.js.map +1 -0
- package/lib/transforms/process-parallel-edges.d.ts +84 -0
- package/lib/transforms/process-parallel-edges.js +222 -0
- package/lib/transforms/process-parallel-edges.js.map +1 -0
- package/lib/transforms/types.d.ts +20 -0
- package/lib/transforms/types.js +15 -0
- package/lib/transforms/types.js.map +1 -0
- package/lib/transforms/update-related-edge.d.ts +9 -0
- package/lib/transforms/update-related-edge.js +24 -0
- package/lib/transforms/update-related-edge.js.map +1 -0
- package/lib/types/canvas.d.ts +1 -1
- package/lib/types/change.d.ts +27 -10
- package/lib/types/element.d.ts +6 -140
- package/lib/types/node.d.ts +3 -3
- package/lib/types/point.d.ts +1 -0
- package/lib/utils/animation.d.ts +1 -1
- package/lib/utils/animation.js +6 -0
- package/lib/utils/animation.js.map +1 -1
- package/lib/utils/behaviors/brush.d.ts +19 -0
- package/lib/utils/behaviors/brush.js +30 -0
- package/lib/utils/behaviors/brush.js.map +1 -0
- package/lib/utils/behaviors/lasso.d.ts +13 -0
- package/lib/utils/behaviors/lasso.js +116 -0
- package/lib/utils/behaviors/lasso.js.map +1 -0
- package/lib/utils/behaviors/utils.d.ts +21 -0
- package/lib/utils/behaviors/utils.js +47 -0
- package/lib/utils/behaviors/utils.js.map +1 -0
- package/lib/utils/change.d.ts +9 -1
- package/lib/utils/change.js +30 -1
- package/lib/utils/change.js.map +1 -1
- package/lib/utils/combo.d.ts +5 -4
- package/lib/utils/combo.js.map +1 -1
- package/lib/utils/edge.d.ts +11 -0
- package/lib/utils/edge.js +2 -1
- package/lib/utils/edge.js.map +1 -1
- package/lib/utils/event/events.d.ts +1 -1
- package/lib/utils/event/events.js.map +1 -1
- package/lib/utils/extension.d.ts +1 -1
- package/lib/utils/extension.js.map +1 -1
- package/lib/utils/id.d.ts +3 -8
- package/lib/utils/id.js +10 -4
- package/lib/utils/id.js.map +1 -1
- package/lib/utils/line.d.ts +21 -0
- package/lib/utils/line.js +46 -0
- package/lib/utils/line.js.map +1 -0
- package/lib/utils/path.d.ts +35 -0
- package/lib/utils/path.js +150 -0
- package/lib/utils/path.js.map +1 -0
- package/lib/utils/point.d.ts +74 -20
- package/lib/utils/point.js +178 -48
- package/lib/utils/point.js.map +1 -1
- package/lib/utils/polygon.d.ts +17 -0
- package/lib/utils/polygon.js +66 -0
- package/lib/utils/polygon.js.map +1 -0
- package/lib/utils/position.d.ts +14 -1
- package/lib/utils/position.js +18 -1
- package/lib/utils/position.js.map +1 -1
- package/lib/utils/prefix.d.ts +1 -1
- package/lib/utils/prefix.js.map +1 -1
- package/lib/utils/shortcut.d.ts +1 -0
- package/lib/utils/shortcut.js +12 -1
- package/lib/utils/shortcut.js.map +1 -1
- package/lib/utils/style.js.map +1 -1
- package/lib/utils/vector.d.ts +3 -2
- package/lib/utils/vector.js +10 -3
- package/lib/utils/vector.js.map +1 -1
- package/package.json +5 -6
- package/src/behaviors/brush-select.ts +306 -0
- package/src/behaviors/click-element.ts +182 -0
- package/src/behaviors/drag-element-force.ts +70 -0
- package/src/behaviors/drag-element.ts +27 -17
- package/src/behaviors/hover-element.ts +2 -3
- package/src/behaviors/index.ts +8 -0
- package/src/behaviors/lasso-select.ts +103 -0
- package/src/behaviors/types.ts +2 -0
- package/src/constants/change.ts +1 -1
- package/src/constants/events/graph.ts +8 -8
- package/src/constants/registry.ts +2 -0
- package/src/elements/combos/base-combo.ts +59 -10
- package/src/elements/combos/circle.ts +8 -11
- package/src/elements/combos/rect.ts +5 -8
- package/src/elements/edges/base-edge.ts +70 -13
- package/src/elements/edges/cubic-horizontal.ts +2 -2
- package/src/elements/edges/cubic-vertical.ts +2 -2
- package/src/elements/edges/cubic.ts +2 -2
- package/src/elements/edges/polyline.ts +2 -2
- package/src/elements/edges/quadratic.ts +2 -2
- package/src/elements/nodes/base-node.ts +115 -19
- package/src/elements/nodes/circle.ts +5 -7
- package/src/elements/nodes/diamond.ts +4 -6
- package/src/elements/nodes/ellipse.ts +6 -8
- package/src/elements/nodes/hexagon.ts +7 -9
- package/src/elements/nodes/image.ts +12 -13
- package/src/elements/nodes/polygon.ts +17 -11
- package/src/elements/nodes/rect.ts +3 -4
- package/src/elements/nodes/star.ts +9 -11
- package/src/elements/nodes/triangle.ts +7 -9
- package/src/exports.ts +4 -2
- package/src/layouts/index.ts +1 -0
- package/src/layouts/types.ts +7 -5
- package/src/palettes/index.ts +13 -0
- package/src/plugins/history/events.ts +25 -0
- package/src/plugins/history/index.ts +222 -0
- package/src/plugins/history/utils.ts +98 -0
- package/src/plugins/hull/index.ts +149 -0
- package/src/plugins/hull/shape.ts +96 -0
- package/src/plugins/hull/util.ts +222 -0
- package/src/plugins/index.ts +4 -0
- package/src/plugins/legend.ts +1 -1
- package/src/registry/build-in.ts +22 -2
- package/src/registry/extension/index.ts +1 -1
- package/src/registry/index.ts +1 -0
- package/src/registry/types.ts +2 -0
- package/src/runtime/batch.ts +38 -0
- package/src/runtime/behavior.ts +1 -1
- package/src/runtime/canvas.ts +51 -13
- package/src/runtime/data.ts +31 -36
- package/src/runtime/element.ts +28 -167
- package/src/runtime/graph.ts +65 -3
- package/src/runtime/layout.ts +48 -79
- package/src/runtime/plugin.ts +1 -1
- package/src/runtime/transform.ts +27 -0
- package/src/runtime/types.ts +14 -0
- package/src/spec/index.ts +1 -0
- package/src/spec/spec.ts +7 -0
- package/src/spec/transform.ts +15 -0
- package/src/themes/base.ts +9 -1
- package/src/transforms/arrange-draw-order.ts +36 -0
- package/src/transforms/base-transform.ts +11 -0
- package/src/transforms/collapse-expand-combo.ts +87 -0
- package/src/transforms/index.ts +7 -0
- package/src/transforms/process-parallel-edges.ts +286 -0
- package/src/transforms/types.ts +23 -0
- package/src/transforms/update-related-edge.ts +28 -0
- package/src/types/canvas.ts +1 -1
- package/src/types/change.ts +28 -10
- package/src/types/element.ts +6 -147
- package/src/types/node.ts +3 -3
- package/src/types/point.ts +1 -0
- package/src/utils/animation.ts +6 -0
- package/src/utils/behaviors/brush.ts +29 -0
- package/src/utils/behaviors/lasso.ts +127 -0
- package/src/utils/behaviors/utils.ts +47 -0
- package/src/utils/change.ts +42 -1
- package/src/utils/combo.ts +6 -5
- package/src/utils/edge.ts +6 -1
- package/src/utils/event/events.ts +3 -1
- package/src/utils/extension.ts +1 -1
- package/src/utils/id.ts +11 -2
- package/src/utils/line.ts +50 -0
- package/src/utils/path.ts +153 -0
- package/src/utils/point.ts +190 -51
- package/src/utils/polygon.ts +72 -0
- package/src/utils/position.ts +18 -1
- package/src/utils/prefix.ts +1 -1
- package/src/utils/shortcut.ts +13 -2
- package/src/utils/style.ts +1 -1
- package/src/utils/vector.ts +10 -3
- package/esm/elements/types.d.ts +0 -0
- package/esm/elements/types.js +0 -15
- package/esm/elements/types.js.map +0 -1
- package/lib/elements/types.d.ts +0 -0
- package/lib/elements/types.js +0 -15
- package/lib/elements/types.js.map +0 -1
- package/src/elements/types.ts +0 -21
package/lib/utils/id.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ID } from '@antv/graphlib';
|
|
2
2
|
import type { ComboData, EdgeData, GraphData, NodeData } from '../spec';
|
|
3
|
+
import type { DataID } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* <zh/> 获取节点/边/Combo 的 ID
|
|
5
6
|
*
|
|
@@ -16,11 +17,5 @@ export declare function idOf(data: Partial<NodeData | EdgeData | ComboData>): ID
|
|
|
16
17
|
* @returns <zh/> 节点/Combo 的父节点 ID | <en/> parent id of node/combo
|
|
17
18
|
*/
|
|
18
19
|
export declare function parentIdOf(data: Partial<NodeData | ComboData>): ID | undefined;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* <en/> Get the IDs of all nodes/edges/combos in the graph data
|
|
23
|
-
* @param data - <zh/> 图数据 | <en/> graph data
|
|
24
|
-
* @returns - <zh/> 返回元素 ID 数组 | <en/> Returns an array of element IDs
|
|
25
|
-
*/
|
|
26
|
-
export declare function getIds(data: GraphData): ID[];
|
|
20
|
+
export declare function idsOf(data: GraphData, flat: true): ID[];
|
|
21
|
+
export declare function idsOf(data: GraphData, flat: false): DataID;
|
package/lib/utils/id.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.idsOf = exports.parentIdOf = exports.idOf = void 0;
|
|
4
4
|
const util_1 = require("@antv/util");
|
|
5
5
|
const is_1 = require("./is");
|
|
6
6
|
/**
|
|
@@ -34,10 +34,16 @@ exports.parentIdOf = parentIdOf;
|
|
|
34
34
|
*
|
|
35
35
|
* <en/> Get the IDs of all nodes/edges/combos in the graph data
|
|
36
36
|
* @param data - <zh/> 图数据 | <en/> graph data
|
|
37
|
+
* @param flat - <zh/> 是否扁平化返回 | <en/> Whether to return flat
|
|
37
38
|
* @returns - <zh/> 返回元素 ID 数组 | <en/> Returns an array of element IDs
|
|
38
39
|
*/
|
|
39
|
-
function
|
|
40
|
-
|
|
40
|
+
function idsOf(data, flat) {
|
|
41
|
+
const ids = {
|
|
42
|
+
nodes: (data.nodes || []).map(idOf),
|
|
43
|
+
edges: (data.edges || []).map(idOf),
|
|
44
|
+
combos: (data.combos || []).map(idOf),
|
|
45
|
+
};
|
|
46
|
+
return flat ? Object.values(ids).flat() : ids;
|
|
41
47
|
}
|
|
42
|
-
exports.
|
|
48
|
+
exports.idsOf = idsOf;
|
|
43
49
|
//# sourceMappingURL=id.js.map
|
package/lib/utils/id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.js","sourceRoot":"src/","sources":["utils/id.ts"],"names":[],"mappings":";;;AACA,qCAAgD;
|
|
1
|
+
{"version":3,"file":"id.js","sourceRoot":"src/","sources":["utils/id.ts"],"names":[],"mappings":";;;AACA,qCAAgD;AAGhD,6BAAkC;AAElC;;;;;;GAMG;AACH,SAAgB,IAAI,CAAC,IAA8C;IACjE,IAAI,IAAA,eAAQ,EAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAA,eAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC,EAAE,CAAC;IAC3D,IAAI,IAAA,eAAU,EAAC,IAAI,CAAC;QAAE,OAAO,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;IAE7D,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;AAC1D,CAAC;AALD,oBAKC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAmC;IAC5D,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC9B,CAAC;AAFD,gCAEC;AAID;;;;;;;GAOG;AACH,SAAgB,KAAK,CAAC,IAAe,EAAE,IAAa;IAClD,MAAM,GAAG,GAAG;QACV,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;QACnC,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;QACnC,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;KACtC,CAAC;IACF,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;AAChD,CAAC;AAPD,sBAOC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Point } from '../types';
|
|
2
|
+
export type LineSegment = [Point, Point];
|
|
3
|
+
/**
|
|
4
|
+
* <zh/> 判断两条线段是否平行
|
|
5
|
+
*
|
|
6
|
+
* <en/> Judge whether two line segments are parallel
|
|
7
|
+
* @param l1 - <zh/> 第一条线段 | <en/> the first line segment
|
|
8
|
+
* @param l2 - <zh/> 第二条线段 | <en/> the second line segment
|
|
9
|
+
* @returns <zh/> 是否平行 | <en/> whether parallel or not
|
|
10
|
+
*/
|
|
11
|
+
export declare function isLinesParallel(l1: LineSegment, l2: LineSegment): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* <zh/> 获取两条线段的交点
|
|
14
|
+
*
|
|
15
|
+
* <en/> Get the intersection of two line segments
|
|
16
|
+
* @param l1 - <zh/> 第一条线段 | <en/> the first line segment
|
|
17
|
+
* @param l2 - <zh/> 第二条线段 | <en/> the second line segment
|
|
18
|
+
* @param extended - <zh/> 是否包含延长线上的交点 | <en/> whether to include the intersection on the extension line
|
|
19
|
+
* @returns <zh/> 交点 | <en/> intersection
|
|
20
|
+
*/
|
|
21
|
+
export declare function getLinesIntersection(l1: LineSegment, l2: LineSegment, extended?: boolean): Point | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLinesIntersection = exports.isLinesParallel = void 0;
|
|
4
|
+
const math_1 = require("./math");
|
|
5
|
+
const vector_1 = require("./vector");
|
|
6
|
+
/**
|
|
7
|
+
* <zh/> 判断两条线段是否平行
|
|
8
|
+
*
|
|
9
|
+
* <en/> Judge whether two line segments are parallel
|
|
10
|
+
* @param l1 - <zh/> 第一条线段 | <en/> the first line segment
|
|
11
|
+
* @param l2 - <zh/> 第二条线段 | <en/> the second line segment
|
|
12
|
+
* @returns <zh/> 是否平行 | <en/> whether parallel or not
|
|
13
|
+
*/
|
|
14
|
+
function isLinesParallel(l1, l2) {
|
|
15
|
+
const [p1, p2] = l1;
|
|
16
|
+
const [p3, p4] = l2;
|
|
17
|
+
const v1 = (0, vector_1.subtract)(p1, p2);
|
|
18
|
+
const v2 = (0, vector_1.subtract)(p3, p4);
|
|
19
|
+
return (0, vector_1.cross)(v1, v2).every((v) => v === 0);
|
|
20
|
+
}
|
|
21
|
+
exports.isLinesParallel = isLinesParallel;
|
|
22
|
+
/**
|
|
23
|
+
* <zh/> 获取两条线段的交点
|
|
24
|
+
*
|
|
25
|
+
* <en/> Get the intersection of two line segments
|
|
26
|
+
* @param l1 - <zh/> 第一条线段 | <en/> the first line segment
|
|
27
|
+
* @param l2 - <zh/> 第二条线段 | <en/> the second line segment
|
|
28
|
+
* @param extended - <zh/> 是否包含延长线上的交点 | <en/> whether to include the intersection on the extension line
|
|
29
|
+
* @returns <zh/> 交点 | <en/> intersection
|
|
30
|
+
*/
|
|
31
|
+
function getLinesIntersection(l1, l2, extended = false) {
|
|
32
|
+
if (isLinesParallel(l1, l2))
|
|
33
|
+
return undefined;
|
|
34
|
+
const [p1, p2] = l1;
|
|
35
|
+
const [p3, p4] = l2;
|
|
36
|
+
const t = ((p1[0] - p3[0]) * (p3[1] - p4[1]) - (p1[1] - p3[1]) * (p3[0] - p4[0])) /
|
|
37
|
+
((p1[0] - p2[0]) * (p3[1] - p4[1]) - (p1[1] - p2[1]) * (p3[0] - p4[0]));
|
|
38
|
+
const u = p4[0] - p3[0]
|
|
39
|
+
? (p1[0] - p3[0] + t * (p2[0] - p1[0])) / (p4[0] - p3[0])
|
|
40
|
+
: (p1[1] - p3[1] + t * (p2[1] - p1[1])) / (p4[1] - p3[1]);
|
|
41
|
+
if (!extended && (!(0, math_1.isBetween)(t, 0, 1) || !(0, math_1.isBetween)(u, 0, 1)))
|
|
42
|
+
return undefined;
|
|
43
|
+
return [p1[0] + t * (p2[0] - p1[0]), p1[1] + t * (p2[1] - p1[1])];
|
|
44
|
+
}
|
|
45
|
+
exports.getLinesIntersection = getLinesIntersection;
|
|
46
|
+
//# sourceMappingURL=line.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line.js","sourceRoot":"src/","sources":["utils/line.ts"],"names":[],"mappings":";;;AACA,iCAAmC;AACnC,qCAA2C;AAI3C;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,EAAe,EAAE,EAAe;IAC9D,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;IACpB,MAAM,EAAE,GAAG,IAAA,iBAAQ,EAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5B,MAAM,EAAE,GAAG,IAAA,iBAAQ,EAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5B,OAAO,IAAA,cAAK,EAAC,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC;AAND,0CAMC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAAC,EAAe,EAAE,EAAe,EAAE,QAAQ,GAAG,KAAK;IACrF,IAAI,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC;IAE9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G,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAA,gBAAS,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAA,gBAAS,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAEhF,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC;AAlBD,oDAkBC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { PathArray } from '@antv/util';
|
|
2
|
+
import type { Point, Points } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* <zh/> points 转化为 path 路径
|
|
5
|
+
*
|
|
6
|
+
* <en/> points transfrom path.
|
|
7
|
+
* @param points Point[]
|
|
8
|
+
* @param isClose boolean
|
|
9
|
+
* @returns path string[][]
|
|
10
|
+
*/
|
|
11
|
+
export declare function pointsToPath(points: Points, isClose?: boolean): PathArray;
|
|
12
|
+
/**
|
|
13
|
+
* <zh/> 将路径字符串转换为路径段数组
|
|
14
|
+
*
|
|
15
|
+
* <en/> Convert a path string to an array of path segments.
|
|
16
|
+
* @param path - <zh/> 路径字符串 | <en/> path string
|
|
17
|
+
* @returns <zh/> 路径段数组 | <en/> path segment array
|
|
18
|
+
*/
|
|
19
|
+
export declare function parsePath(path: string): PathArray;
|
|
20
|
+
/**
|
|
21
|
+
* <zh/> 将路径转换为点数组
|
|
22
|
+
*
|
|
23
|
+
* <en/> Convert path to points array
|
|
24
|
+
* @param path - <zh/> 路径数组 <en/> path array
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export declare function pathToPoints(path: string | PathArray): Point[];
|
|
28
|
+
/**
|
|
29
|
+
* <zh/> 生成平滑闭合曲线
|
|
30
|
+
*
|
|
31
|
+
* <en/> Generate smooth closed curves
|
|
32
|
+
* @param points - <zh/> 点集 | <en/> points
|
|
33
|
+
* @returns <zh/> 平滑闭合曲线 | <en/> smooth closed curves
|
|
34
|
+
*/
|
|
35
|
+
export declare const getClosedSpline: (points: Point[]) => PathArray;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getClosedSpline = exports.pathToPoints = exports.parsePath = exports.pointsToPath = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* <zh/> points 转化为 path 路径
|
|
6
|
+
*
|
|
7
|
+
* <en/> points transfrom path.
|
|
8
|
+
* @param points Point[]
|
|
9
|
+
* @param isClose boolean
|
|
10
|
+
* @returns path string[][]
|
|
11
|
+
*/
|
|
12
|
+
function pointsToPath(points, isClose = true) {
|
|
13
|
+
const path = [];
|
|
14
|
+
points.forEach((point, index) => {
|
|
15
|
+
path.push([index === 0 ? 'M' : 'L', ...point]);
|
|
16
|
+
});
|
|
17
|
+
if (isClose) {
|
|
18
|
+
path.push(['Z']);
|
|
19
|
+
}
|
|
20
|
+
return path;
|
|
21
|
+
}
|
|
22
|
+
exports.pointsToPath = pointsToPath;
|
|
23
|
+
const PATH_COMMANDS = {
|
|
24
|
+
M: ['x', 'y'],
|
|
25
|
+
m: ['dx', 'dy'],
|
|
26
|
+
H: ['x'],
|
|
27
|
+
h: ['dx'],
|
|
28
|
+
V: ['y'],
|
|
29
|
+
v: ['dy'],
|
|
30
|
+
L: ['x', 'y'],
|
|
31
|
+
l: ['dx', 'dy'],
|
|
32
|
+
Z: [],
|
|
33
|
+
z: [],
|
|
34
|
+
C: ['x1', 'y1', 'x2', 'y2', 'x', 'y'],
|
|
35
|
+
c: ['dx1', 'dy1', 'dx2', 'dy2', 'dx', 'dy'],
|
|
36
|
+
S: ['x2', 'y2', 'x', 'y'],
|
|
37
|
+
s: ['dx2', 'dy2', 'dx', 'dy'],
|
|
38
|
+
Q: ['x1', 'y1', 'x', 'y'],
|
|
39
|
+
q: ['dx1', 'dy1', 'dx', 'dy'],
|
|
40
|
+
T: ['x', 'y'],
|
|
41
|
+
t: ['dx', 'dy'],
|
|
42
|
+
A: ['rx', 'ry', 'rotation', 'large-arc', 'sweep', 'x', 'y'],
|
|
43
|
+
a: ['rx', 'ry', 'rotation', 'large-arc', 'sweep', 'dx', 'dy'],
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* <zh/> 将路径字符串转换为路径段数组
|
|
47
|
+
*
|
|
48
|
+
* <en/> Convert a path string to an array of path segments.
|
|
49
|
+
* @param path - <zh/> 路径字符串 | <en/> path string
|
|
50
|
+
* @returns <zh/> 路径段数组 | <en/> path segment array
|
|
51
|
+
*/
|
|
52
|
+
function parsePath(path) {
|
|
53
|
+
const items = path
|
|
54
|
+
.replace(/[\n\r]/g, '')
|
|
55
|
+
.replace(/-/g, ' -')
|
|
56
|
+
.replace(/(\d*\.)(\d+)(?=\.)/g, '$1$2 ')
|
|
57
|
+
.trim()
|
|
58
|
+
.split(/\s*,|\s+/);
|
|
59
|
+
const segments = [];
|
|
60
|
+
let currentCommand = '';
|
|
61
|
+
let currentElement = {};
|
|
62
|
+
while (items.length > 0) {
|
|
63
|
+
let it = items.shift();
|
|
64
|
+
if (it in PATH_COMMANDS) {
|
|
65
|
+
currentCommand = it;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
items.unshift(it);
|
|
69
|
+
}
|
|
70
|
+
currentElement = { type: currentCommand };
|
|
71
|
+
PATH_COMMANDS[currentCommand].forEach((prop) => {
|
|
72
|
+
it = items.shift(); // TODO sanity check
|
|
73
|
+
currentElement[prop] = it;
|
|
74
|
+
});
|
|
75
|
+
if (currentCommand === 'M') {
|
|
76
|
+
currentCommand = 'L';
|
|
77
|
+
}
|
|
78
|
+
else if (currentCommand === 'm') {
|
|
79
|
+
currentCommand = 'l';
|
|
80
|
+
}
|
|
81
|
+
const [type, ...values] = Object.values(currentElement);
|
|
82
|
+
segments.push([type, ...values.map(Number)]);
|
|
83
|
+
}
|
|
84
|
+
return segments;
|
|
85
|
+
}
|
|
86
|
+
exports.parsePath = parsePath;
|
|
87
|
+
/**
|
|
88
|
+
* <zh/> 将路径转换为点数组
|
|
89
|
+
*
|
|
90
|
+
* <en/> Convert path to points array
|
|
91
|
+
* @param path - <zh/> 路径数组 <en/> path array
|
|
92
|
+
* @returns
|
|
93
|
+
*/
|
|
94
|
+
function pathToPoints(path) {
|
|
95
|
+
const points = [];
|
|
96
|
+
const segments = typeof path === 'string' ? parsePath(path) : path;
|
|
97
|
+
segments.forEach((seg) => {
|
|
98
|
+
const command = seg[0];
|
|
99
|
+
if (command === 'Z') {
|
|
100
|
+
points.push(points[0]);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (command !== 'A') {
|
|
104
|
+
for (let i = 1; i < seg.length; i = i + 2) {
|
|
105
|
+
points.push([seg[i], seg[i + 1], 0]);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const length = seg.length;
|
|
110
|
+
points.push([seg[length - 2], seg[length - 1], 0]);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return points;
|
|
114
|
+
}
|
|
115
|
+
exports.pathToPoints = pathToPoints;
|
|
116
|
+
/**
|
|
117
|
+
* <zh/> 生成平滑闭合曲线
|
|
118
|
+
*
|
|
119
|
+
* <en/> Generate smooth closed curves
|
|
120
|
+
* @param points - <zh/> 点集 | <en/> points
|
|
121
|
+
* @returns <zh/> 平滑闭合曲线 | <en/> smooth closed curves
|
|
122
|
+
*/
|
|
123
|
+
const getClosedSpline = (points) => {
|
|
124
|
+
if (points.length < 2)
|
|
125
|
+
return [
|
|
126
|
+
['M', 0, 0],
|
|
127
|
+
['L', 0, 0],
|
|
128
|
+
];
|
|
129
|
+
const first = points[0];
|
|
130
|
+
const second = points[1];
|
|
131
|
+
const last = points[points.length - 1];
|
|
132
|
+
const lastSecond = points[points.length - 2];
|
|
133
|
+
points.unshift(lastSecond, last);
|
|
134
|
+
points.push(first, second);
|
|
135
|
+
const closedPath = [['M', last[0], last[1]]];
|
|
136
|
+
for (let i = 1; i < points.length - 2; i += 1) {
|
|
137
|
+
const [x0, y0] = points[i - 1];
|
|
138
|
+
const [x1, y1] = points[i];
|
|
139
|
+
const [x2, y2] = points[i + 1];
|
|
140
|
+
const [x3, y3] = i !== points.length - 2 ? points[i + 2] : [x2, y2];
|
|
141
|
+
const cp1x = x1 + (x2 - x0) / 6;
|
|
142
|
+
const cp1y = y1 + (y2 - y0) / 6;
|
|
143
|
+
const cp2x = x2 - (x3 - x1) / 6;
|
|
144
|
+
const cp2y = y2 - (y3 - y1) / 6;
|
|
145
|
+
closedPath.push(['C', cp1x, cp1y, cp2x, cp2y, x2, y2]);
|
|
146
|
+
}
|
|
147
|
+
return closedPath;
|
|
148
|
+
};
|
|
149
|
+
exports.getClosedSpline = getClosedSpline;
|
|
150
|
+
//# sourceMappingURL=path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"src/","sources":["utils/path.ts"],"names":[],"mappings":";;;AAGA;;;;;;;GAOG;AACH,SAAgB,YAAY,CAAC,MAAc,EAAE,OAAO,GAAG,IAAI;IACzD,MAAM,IAAI,GAAG,EAAE,CAAC;IAEhB,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC9B,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,I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MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAEpE,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAChC,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,UAAuB,CAAC;AACjC,CAAC,CAAC;AA7BW,QAAA,eAAe,mBA6B1B"}
|
package/lib/utils/point.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AABB, PointLike } from '@antv/g';
|
|
2
2
|
import type { Point } from '../types';
|
|
3
|
+
import type { LineSegment } from './line';
|
|
3
4
|
/**
|
|
4
5
|
* <zh/> 将对象坐标转换为数组坐标
|
|
5
6
|
* <en/> Convert object coordinates to array coordinates
|
|
@@ -15,6 +16,21 @@ export declare function parsePoint(point: PointLike): Point;
|
|
|
15
16
|
* @returns <zh/> 对象坐标 | <en/> object coordinates
|
|
16
17
|
*/
|
|
17
18
|
export declare function toPointObject(point: Point): PointLike;
|
|
19
|
+
/**
|
|
20
|
+
* <zh/> 根据 X 轴坐标排序
|
|
21
|
+
* <en/> Sort by X-axis coordinates
|
|
22
|
+
* @param points - <zh/> 点集 | <en/> point set
|
|
23
|
+
* @returns <zh/> 排序后的点集 | <en/> sorted point set
|
|
24
|
+
*/
|
|
25
|
+
export declare function sortByX(points: Point[]): Point[];
|
|
26
|
+
/**
|
|
27
|
+
* <zh/> 点集去重
|
|
28
|
+
*
|
|
29
|
+
* <en/> Deduplicate point set
|
|
30
|
+
* @param points - <zh/> 点集 | <en/> pointset
|
|
31
|
+
* @returns <zh/> 去重后的点集 | <en/> deduplicated pointset
|
|
32
|
+
*/
|
|
33
|
+
export declare function deduplicate(points: Point[]): Point[];
|
|
18
34
|
/**
|
|
19
35
|
* <zh/> 对点格式化,精确到 `digits` 位的数字
|
|
20
36
|
*
|
|
@@ -72,24 +88,6 @@ export declare function isOrthogonal(p1: Point, p2: Point): boolean;
|
|
|
72
88
|
* @returns <zh/> 是否三点共线 | <en/> whether three points are collinear
|
|
73
89
|
*/
|
|
74
90
|
export declare function isCollinear(p1: Point, p2: Point, p3: Point): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* <zh/> 判断两条线段是否平行
|
|
77
|
-
*
|
|
78
|
-
* <en/> Judge whether two line segments are parallel
|
|
79
|
-
* @param l1 - <zh/> 第一条线段 | <en/> the first line segment
|
|
80
|
-
* @param l2 - <zh/> 第二条线段 | <en/> the second line segment
|
|
81
|
-
* @returns <zh/> 是否平行 | <en/> whether parallel or not
|
|
82
|
-
*/
|
|
83
|
-
export declare function isLinesParallel(l1: [Point, Point], l2: [Point, Point]): boolean;
|
|
84
|
-
/**
|
|
85
|
-
* <zh/> 获取两条线段的交点
|
|
86
|
-
*
|
|
87
|
-
* <en/> Get the intersection of two line segments
|
|
88
|
-
* @param l1 - <zh/> 第一条线段 | <en/> the first line segment
|
|
89
|
-
* @param l2 - <zh/> 第二条线段 | <en/> the second line segment
|
|
90
|
-
* @returns <zh/> 交点 | <en/> intersection
|
|
91
|
-
*/
|
|
92
|
-
export declare function getLinesIntersection(l1: [Point, Point], l2: [Point, Point]): Point | undefined;
|
|
93
91
|
/**
|
|
94
92
|
* <zh/> 获取从多边形中心到给定点的连线与多边形边缘的交点
|
|
95
93
|
*
|
|
@@ -98,9 +96,21 @@ export declare function getLinesIntersection(l1: [Point, Point], l2: [Point, Poi
|
|
|
98
96
|
* @param center - <zh/> 多边形中心 | <en/> the center of the polygon
|
|
99
97
|
* @param points - <zh/> 多边形顶点 | <en/> the vertices of the polygon
|
|
100
98
|
* @param isRelativePos - <zh/> 顶点坐标是否相对中心点 | <en/> whether the vertex coordinates are relative to the center point
|
|
101
|
-
* @returns <zh/>
|
|
99
|
+
* @returns <zh/> 交点与相交线段 | <en/> intersection and intersecting line segment
|
|
100
|
+
*/
|
|
101
|
+
export declare function getPolygonIntersectPoint(p: Point, center: Point, points: Point[], isRelativePos?: boolean): {
|
|
102
|
+
point: Point;
|
|
103
|
+
line?: LineSegment;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* <zh/> 判断点是否在多边形内部(射线法)
|
|
107
|
+
*
|
|
108
|
+
* <en/> Whether point is inside the polygon (ray algo)
|
|
109
|
+
* @param point - <zh/> 点 | <en/> point
|
|
110
|
+
* @param points - <zh/> 多边形顶点 | <en/> polygon vertices
|
|
111
|
+
* @returns <zh/> 是否在多边形内部 | <en/> whether inside the polygon
|
|
102
112
|
*/
|
|
103
|
-
export declare function
|
|
113
|
+
export declare function isPointInPolygon(point: Point, points: Point[]): boolean;
|
|
104
114
|
/**
|
|
105
115
|
* <zh/> 获取从矩形中心到给定点的连线与矩形边缘的交点
|
|
106
116
|
*
|
|
@@ -127,3 +137,47 @@ export declare function getEllipseIntersectPoint(p: Point, bbox: AABB): Point;
|
|
|
127
137
|
* @returns <zh/> 距离最近的两个点 | <en/> the nearest two points
|
|
128
138
|
*/
|
|
129
139
|
export declare function findNearestPoints(group1: Point[], group2: Point[]): [Point, Point];
|
|
140
|
+
/**
|
|
141
|
+
* <zh/> 从一组线段中找到距离给定点最近的线段
|
|
142
|
+
*
|
|
143
|
+
* <en/> Find the line segment closest to the given point from a group of line segments
|
|
144
|
+
* @param point - <zh/> 给定点 | <en/> the given point
|
|
145
|
+
* @param lines - <zh/> 一组线段 | <en/> a group of line segments
|
|
146
|
+
* @returns <zh/> 距离最近的线段 | <en/> the nearest line segment
|
|
147
|
+
*/
|
|
148
|
+
export declare function findNearestLine(point: Point, lines: LineSegment[]): [Point, Point];
|
|
149
|
+
/**
|
|
150
|
+
* <zh/> 获取点到线段的距离
|
|
151
|
+
*
|
|
152
|
+
* <en/> Get the distance from a point to a line segment
|
|
153
|
+
* @param point - <zh/> 点 | <en/> the point
|
|
154
|
+
* @param line - <zh/> 线段 | <en/> the line segment
|
|
155
|
+
* @returns <zh/> 点到线段的距离 | <en/> the distance from the point to the line segment
|
|
156
|
+
*/
|
|
157
|
+
export declare function getDistanceToLine(point: Point, line: LineSegment): number;
|
|
158
|
+
/**
|
|
159
|
+
* <zh/> 获取线段上距离给定点最近的点
|
|
160
|
+
*
|
|
161
|
+
* <en/> Get the point on the line segment closest to the given point
|
|
162
|
+
* @param point - <zh/> 给定点 | <en/> the given point
|
|
163
|
+
* @param line - <zh/> 线段 | <en/> the line segment
|
|
164
|
+
* @returns <zh/> 线段上距离给定点最近的点 | <en/> the point on the line segment closest to the given point
|
|
165
|
+
*/
|
|
166
|
+
export declare function findNearestPointOnLine(point: Point, line: LineSegment): Point;
|
|
167
|
+
/**
|
|
168
|
+
* <zh/> 获取点集的中心点
|
|
169
|
+
*
|
|
170
|
+
* <en/> Get the center point of a set of points
|
|
171
|
+
* @param points - <zh/> 点集 | <en/> point set
|
|
172
|
+
* @returns <zh/> 中心点 | <en/> center point
|
|
173
|
+
*/
|
|
174
|
+
export declare function centerOf(points: Point[]): Point;
|
|
175
|
+
/**
|
|
176
|
+
* <zh/> 按顺时针或逆时针方向对点集排序
|
|
177
|
+
*
|
|
178
|
+
* <en/> Sort the point set in a clockwise or counterclockwise direction
|
|
179
|
+
* @param points - <zh/> 点集 | <en/> point set
|
|
180
|
+
* @param clockwise - <zh/> 是否顺时针 | <en/> whether clockwise
|
|
181
|
+
* @returns <zh/> 排序后的点集 | <en/> sorted point set
|
|
182
|
+
*/
|
|
183
|
+
export declare function sortByClockwise(points: Point[], clockwise?: boolean): Point[];
|