@antv/g6 5.0.0-beta.37 → 5.0.0-beta.39
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/animations/executor.d.ts +4 -5
- package/dist/lib/animations/index.d.ts +22 -8
- package/dist/lib/animations/types.d.ts +78 -20
- package/dist/lib/behaviors/{click-element.d.ts → click-select.d.ts} +27 -11
- package/dist/lib/behaviors/collapse-expand.d.ts +10 -1
- package/dist/lib/behaviors/drag-canvas.d.ts +1 -0
- package/{lib/behaviors/hover-element.d.ts → dist/lib/behaviors/hover-activate.d.ts} +7 -5
- package/dist/lib/behaviors/index.d.ts +4 -4
- package/dist/lib/constants/animation.d.ts +3 -2
- package/dist/lib/constants/events/animation.d.ts +2 -0
- package/dist/lib/constants/events/graph.d.ts +0 -12
- package/dist/lib/elements/base-element.d.ts +35 -0
- package/dist/lib/elements/combos/base-combo.d.ts +8 -32
- package/dist/lib/elements/combos/circle.d.ts +1 -2
- package/dist/lib/elements/edges/base-edge.d.ts +21 -30
- package/dist/lib/elements/nodes/base-node.d.ts +7 -27
- package/dist/lib/elements/nodes/html.d.ts +2 -1
- package/dist/lib/elements/shapes/badge.d.ts +1 -1
- package/dist/lib/elements/shapes/base-shape.d.ts +6 -0
- package/dist/lib/exports.d.ts +6 -5
- package/dist/lib/layouts/index.d.ts +1 -1
- package/dist/lib/layouts/types.d.ts +3 -3
- package/dist/lib/plugins/background/index.d.ts +38 -0
- package/{esm/plugins/contextmenu.d.ts → dist/lib/plugins/contextmenu/index.d.ts} +5 -5
- package/dist/lib/plugins/index.d.ts +2 -0
- package/{lib/plugins/watermark.d.ts → dist/lib/plugins/watermark/index.d.ts} +3 -3
- package/dist/lib/runtime/animation.d.ts +54 -0
- package/dist/lib/runtime/canvas.d.ts +0 -2
- package/dist/lib/runtime/data.d.ts +13 -4
- package/dist/lib/runtime/element.d.ts +27 -41
- package/dist/lib/runtime/graph.d.ts +1 -0
- package/dist/lib/runtime/layout.d.ts +7 -0
- package/dist/lib/runtime/transform.d.ts +1 -0
- package/dist/lib/runtime/types.d.ts +7 -0
- package/dist/lib/spec/data.d.ts +14 -0
- package/dist/lib/spec/element/animation.d.ts +3 -9
- package/dist/lib/spec/element/combo.d.ts +4 -3
- package/dist/lib/spec/element/edge.d.ts +4 -3
- package/dist/lib/spec/element/node.d.ts +4 -3
- package/dist/lib/transforms/base-transform.d.ts +2 -1
- package/dist/lib/transforms/collapse-expand-combo.d.ts +4 -3
- package/dist/lib/transforms/collapse-expand-node.d.ts +12 -0
- package/dist/lib/transforms/get-edge-actual-ends.d.ts +13 -0
- package/dist/lib/transforms/index.d.ts +2 -0
- package/dist/lib/transforms/process-parallel-edges.d.ts +6 -4
- package/dist/lib/transforms/types.d.ts +2 -2
- package/dist/lib/transforms/update-related-edge.d.ts +2 -1
- package/dist/lib/transforms/utils.d.ts +13 -0
- package/dist/lib/types/animation.d.ts +1 -2
- package/dist/lib/types/node.d.ts +24 -0
- package/dist/lib/utils/animation.d.ts +17 -29
- package/dist/lib/utils/collapsibility.d.ts +9 -0
- package/dist/lib/utils/element.d.ts +19 -2
- package/dist/lib/utils/prefix.d.ts +1 -1
- package/dist/lib/utils/style.d.ts +10 -0
- package/dist/lib/utils/theme.d.ts +9 -0
- package/dist/lib/utils/transform.d.ts +14 -0
- package/esm/animations/executor.d.ts +4 -5
- package/esm/animations/executor.js +31 -48
- package/esm/animations/executor.js.map +1 -1
- package/esm/animations/index.d.ts +22 -8
- package/esm/animations/index.js +10 -12
- package/esm/animations/index.js.map +1 -1
- package/esm/animations/types.d.ts +78 -20
- package/{lib/behaviors/click-element.d.ts → esm/behaviors/click-select.d.ts} +27 -11
- package/esm/behaviors/{click-element.js → click-select.js} +40 -24
- package/esm/behaviors/click-select.js.map +1 -0
- package/esm/behaviors/collapse-expand.d.ts +10 -1
- package/esm/behaviors/collapse-expand.js +15 -6
- package/esm/behaviors/collapse-expand.js.map +1 -1
- package/esm/behaviors/create-edge.js +2 -2
- package/esm/behaviors/create-edge.js.map +1 -1
- package/esm/behaviors/drag-canvas.d.ts +1 -0
- package/esm/behaviors/drag-canvas.js +5 -1
- package/esm/behaviors/drag-canvas.js.map +1 -1
- package/esm/behaviors/drag-element.js +2 -2
- package/esm/behaviors/drag-element.js.map +1 -1
- package/{dist/lib/behaviors/hover-element.d.ts → esm/behaviors/hover-activate.d.ts} +7 -5
- package/esm/behaviors/{hover-element.js → hover-activate.js} +19 -9
- package/esm/behaviors/hover-activate.js.map +1 -0
- package/esm/behaviors/index.d.ts +4 -4
- package/esm/behaviors/index.js +2 -2
- package/esm/behaviors/index.js.map +1 -1
- package/esm/constants/animation.d.ts +3 -2
- package/esm/constants/animation.js.map +1 -1
- package/esm/constants/events/animation.d.ts +2 -0
- package/esm/constants/events/animation.js +2 -0
- package/esm/constants/events/animation.js.map +1 -1
- package/esm/constants/events/graph.d.ts +0 -12
- package/esm/constants/events/graph.js +0 -12
- package/esm/constants/events/graph.js.map +1 -1
- package/esm/elements/base-element.d.ts +35 -0
- package/esm/elements/base-element.js +42 -0
- package/esm/elements/base-element.js.map +1 -0
- package/esm/elements/combos/base-combo.d.ts +8 -32
- package/esm/elements/combos/base-combo.js +55 -56
- package/esm/elements/combos/base-combo.js.map +1 -1
- package/esm/elements/combos/circle.d.ts +1 -2
- package/esm/elements/combos/circle.js +1 -12
- package/esm/elements/combos/circle.js.map +1 -1
- package/esm/elements/combos/rect.js +1 -2
- package/esm/elements/combos/rect.js.map +1 -1
- package/esm/elements/edges/base-edge.d.ts +21 -30
- package/esm/elements/edges/base-edge.js +43 -39
- package/esm/elements/edges/base-edge.js.map +1 -1
- package/esm/elements/edges/cubic-horizontal.js +2 -2
- package/esm/elements/edges/cubic-horizontal.js.map +1 -1
- package/esm/elements/edges/cubic-vertical.js +2 -2
- package/esm/elements/edges/cubic-vertical.js.map +1 -1
- package/esm/elements/edges/cubic.js +2 -2
- package/esm/elements/edges/cubic.js.map +1 -1
- package/esm/elements/edges/line.js +2 -2
- package/esm/elements/edges/line.js.map +1 -1
- package/esm/elements/edges/polyline.js +10 -6
- package/esm/elements/edges/polyline.js.map +1 -1
- package/esm/elements/edges/quadratic.js +2 -2
- package/esm/elements/edges/quadratic.js.map +1 -1
- package/esm/elements/nodes/base-node.d.ts +7 -27
- package/esm/elements/nodes/base-node.js +24 -46
- package/esm/elements/nodes/base-node.js.map +1 -1
- package/esm/elements/nodes/circle.js +2 -2
- package/esm/elements/nodes/circle.js.map +1 -1
- package/esm/elements/nodes/donut.js +3 -2
- package/esm/elements/nodes/donut.js.map +1 -1
- package/esm/elements/nodes/ellipse.js +2 -2
- package/esm/elements/nodes/ellipse.js.map +1 -1
- package/esm/elements/nodes/html.d.ts +2 -1
- package/esm/elements/nodes/html.js +8 -1
- package/esm/elements/nodes/html.js.map +1 -1
- package/esm/elements/nodes/image.js +2 -2
- package/esm/elements/nodes/image.js.map +1 -1
- package/esm/elements/nodes/rect.js +2 -2
- package/esm/elements/nodes/rect.js.map +1 -1
- package/esm/elements/nodes/triangle.js +3 -2
- package/esm/elements/nodes/triangle.js.map +1 -1
- package/esm/elements/shapes/badge.d.ts +1 -1
- package/esm/elements/shapes/badge.js +2 -2
- package/esm/elements/shapes/badge.js.map +1 -1
- package/esm/elements/shapes/base-shape.d.ts +6 -0
- package/esm/elements/shapes/base-shape.js +23 -6
- package/esm/elements/shapes/base-shape.js.map +1 -1
- package/esm/elements/shapes/contour.js +2 -2
- package/esm/elements/shapes/contour.js.map +1 -1
- package/esm/elements/shapes/label.js +2 -2
- package/esm/elements/shapes/label.js.map +1 -1
- package/esm/exports.d.ts +6 -5
- package/esm/exports.js +2 -2
- 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 +3 -3
- package/esm/plugins/background/index.d.ts +38 -0
- package/esm/plugins/background/index.js +48 -0
- package/esm/plugins/background/index.js.map +1 -0
- package/{dist/lib/plugins/contextmenu.d.ts → esm/plugins/contextmenu/index.d.ts} +5 -5
- package/esm/plugins/{contextmenu.js → contextmenu/index.js} +4 -4
- package/esm/plugins/contextmenu/index.js.map +1 -0
- package/esm/{utils/contextmenu.js → plugins/contextmenu/util.js} +1 -1
- package/esm/{utils/contextmenu.js.map → plugins/contextmenu/util.js.map} +1 -1
- package/esm/plugins/history/index.js +1 -1
- package/esm/plugins/history/index.js.map +1 -1
- package/esm/plugins/history/{utils.js → util.js} +1 -1
- package/esm/plugins/history/util.js.map +1 -0
- package/esm/plugins/index.d.ts +2 -0
- package/esm/plugins/index.js +1 -0
- package/esm/plugins/index.js.map +1 -1
- package/esm/plugins/timebar.js +1 -1
- package/esm/plugins/timebar.js.map +1 -1
- package/esm/plugins/{watermark.d.ts → watermark/index.d.ts} +3 -3
- package/esm/plugins/{watermark.js → watermark/index.js} +4 -4
- package/esm/plugins/watermark/index.js.map +1 -0
- package/esm/{utils/watermark.js → plugins/watermark/util.js} +1 -1
- package/esm/plugins/watermark/util.js.map +1 -0
- package/esm/registry/build-in.js +19 -12
- package/esm/registry/build-in.js.map +1 -1
- package/esm/runtime/animation.d.ts +54 -0
- package/esm/runtime/animation.js +139 -0
- package/esm/runtime/animation.js.map +1 -0
- package/esm/runtime/canvas.d.ts +0 -2
- package/esm/runtime/canvas.js +0 -21
- package/esm/runtime/canvas.js.map +1 -1
- package/esm/runtime/data.d.ts +13 -4
- package/esm/runtime/data.js +35 -24
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +27 -41
- package/esm/runtime/element.js +239 -193
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +1 -0
- package/esm/runtime/graph.js +45 -11
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/layout.d.ts +7 -0
- package/esm/runtime/layout.js +44 -3
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/transform.d.ts +1 -0
- package/esm/runtime/transform.js +9 -2
- package/esm/runtime/transform.js.map +1 -1
- package/esm/runtime/types.d.ts +7 -0
- package/esm/runtime/viewport.js +2 -2
- package/esm/runtime/viewport.js.map +1 -1
- package/esm/spec/data.d.ts +14 -0
- package/esm/spec/element/animation.d.ts +3 -9
- package/esm/spec/element/combo.d.ts +4 -3
- package/esm/spec/element/edge.d.ts +4 -3
- package/esm/spec/element/node.d.ts +4 -3
- package/esm/themes/base.js +14 -10
- package/esm/themes/base.js.map +1 -1
- package/esm/transforms/base-transform.d.ts +2 -1
- package/esm/transforms/base-transform.js +1 -1
- package/esm/transforms/base-transform.js.map +1 -1
- package/esm/transforms/collapse-expand-combo.d.ts +4 -3
- package/esm/transforms/collapse-expand-combo.js +9 -25
- package/esm/transforms/collapse-expand-combo.js.map +1 -1
- package/esm/transforms/collapse-expand-node.d.ts +12 -0
- package/esm/transforms/collapse-expand-node.js +91 -0
- package/esm/transforms/collapse-expand-node.js.map +1 -0
- package/esm/transforms/get-edge-actual-ends.d.ts +13 -0
- package/esm/transforms/get-edge-actual-ends.js +36 -0
- package/esm/transforms/get-edge-actual-ends.js.map +1 -0
- package/esm/transforms/index.d.ts +2 -0
- package/esm/transforms/index.js +2 -0
- package/esm/transforms/index.js.map +1 -1
- package/esm/transforms/process-parallel-edges.d.ts +6 -4
- package/esm/transforms/process-parallel-edges.js +42 -27
- package/esm/transforms/process-parallel-edges.js.map +1 -1
- package/esm/transforms/types.d.ts +2 -2
- package/esm/transforms/types.js +1 -10
- package/esm/transforms/types.js.map +1 -1
- package/esm/transforms/update-related-edge.d.ts +2 -1
- package/esm/transforms/update-related-edge.js +4 -1
- package/esm/transforms/update-related-edge.js.map +1 -1
- package/esm/transforms/utils.d.ts +13 -0
- package/esm/transforms/utils.js +25 -0
- package/esm/transforms/utils.js.map +1 -0
- package/esm/types/animation.d.ts +1 -2
- package/esm/types/node.d.ts +24 -0
- package/esm/utils/animation.d.ts +17 -29
- package/esm/utils/animation.js +64 -54
- package/esm/utils/animation.js.map +1 -1
- package/esm/utils/cache.js +0 -1
- package/esm/utils/cache.js.map +1 -1
- package/esm/utils/collapsibility.d.ts +9 -0
- package/esm/utils/collapsibility.js +11 -0
- package/esm/utils/collapsibility.js.map +1 -0
- package/esm/utils/dom.js +1 -2
- package/esm/utils/dom.js.map +1 -1
- package/esm/utils/edge.js +2 -1
- package/esm/utils/edge.js.map +1 -1
- package/esm/utils/element.d.ts +19 -2
- package/esm/utils/element.js +24 -3
- package/esm/utils/element.js.map +1 -1
- package/esm/utils/id.js +2 -4
- package/esm/utils/id.js.map +1 -1
- package/esm/utils/palette.js +17 -9
- package/esm/utils/palette.js.map +1 -1
- package/esm/utils/prefix.d.ts +1 -1
- package/esm/utils/prefix.js +7 -6
- package/esm/utils/prefix.js.map +1 -1
- package/esm/utils/shape.js +1 -1
- package/esm/utils/shape.js.map +1 -1
- package/esm/utils/size.js +2 -3
- package/esm/utils/size.js.map +1 -1
- package/esm/utils/style.d.ts +10 -0
- package/esm/utils/style.js +15 -0
- package/esm/utils/style.js.map +1 -1
- package/esm/utils/theme.d.ts +9 -0
- package/esm/utils/theme.js +17 -0
- package/esm/utils/theme.js.map +1 -0
- package/esm/utils/transform.d.ts +14 -0
- package/esm/utils/transform.js +24 -0
- package/esm/utils/transform.js.map +1 -1
- package/lib/animations/executor.d.ts +4 -5
- package/lib/animations/executor.js +30 -47
- package/lib/animations/executor.js.map +1 -1
- package/lib/animations/index.d.ts +22 -8
- package/lib/animations/index.js +12 -14
- package/lib/animations/index.js.map +1 -1
- package/lib/animations/types.d.ts +78 -20
- package/{esm/behaviors/click-element.d.ts → lib/behaviors/click-select.d.ts} +27 -11
- package/lib/behaviors/{click-element.js → click-select.js} +42 -26
- package/lib/behaviors/click-select.js.map +1 -0
- package/lib/behaviors/collapse-expand.d.ts +10 -1
- package/lib/behaviors/collapse-expand.js +15 -6
- package/lib/behaviors/collapse-expand.js.map +1 -1
- package/lib/behaviors/create-edge.js +2 -2
- package/lib/behaviors/create-edge.js.map +1 -1
- package/lib/behaviors/drag-canvas.d.ts +1 -0
- package/lib/behaviors/drag-canvas.js +5 -1
- package/lib/behaviors/drag-canvas.js.map +1 -1
- package/lib/behaviors/drag-element.js +2 -2
- package/lib/behaviors/drag-element.js.map +1 -1
- package/{esm/behaviors/hover-element.d.ts → lib/behaviors/hover-activate.d.ts} +7 -5
- package/lib/behaviors/{hover-element.js → hover-activate.js} +21 -11
- package/lib/behaviors/hover-activate.js.map +1 -0
- package/lib/behaviors/index.d.ts +4 -4
- package/lib/behaviors/index.js +5 -5
- package/lib/behaviors/index.js.map +1 -1
- package/lib/constants/animation.d.ts +3 -2
- package/lib/constants/animation.js.map +1 -1
- package/lib/constants/events/animation.d.ts +2 -0
- package/lib/constants/events/animation.js +2 -0
- package/lib/constants/events/animation.js.map +1 -1
- package/lib/constants/events/graph.d.ts +0 -12
- package/lib/constants/events/graph.js +0 -12
- package/lib/constants/events/graph.js.map +1 -1
- package/lib/elements/base-element.d.ts +35 -0
- package/lib/elements/base-element.js +46 -0
- package/lib/elements/base-element.js.map +1 -0
- package/lib/elements/combos/base-combo.d.ts +8 -32
- package/lib/elements/combos/base-combo.js +54 -55
- package/lib/elements/combos/base-combo.js.map +1 -1
- package/lib/elements/combos/circle.d.ts +1 -2
- package/lib/elements/combos/circle.js +1 -12
- package/lib/elements/combos/circle.js.map +1 -1
- package/lib/elements/combos/rect.js +1 -2
- package/lib/elements/combos/rect.js.map +1 -1
- package/lib/elements/edges/base-edge.d.ts +21 -30
- package/lib/elements/edges/base-edge.js +42 -38
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/edges/cubic-horizontal.js +2 -2
- package/lib/elements/edges/cubic-horizontal.js.map +1 -1
- package/lib/elements/edges/cubic-vertical.js +2 -2
- package/lib/elements/edges/cubic-vertical.js.map +1 -1
- package/lib/elements/edges/cubic.js +2 -2
- package/lib/elements/edges/cubic.js.map +1 -1
- package/lib/elements/edges/line.js +2 -2
- package/lib/elements/edges/line.js.map +1 -1
- package/lib/elements/edges/polyline.js +10 -6
- package/lib/elements/edges/polyline.js.map +1 -1
- package/lib/elements/edges/quadratic.js +2 -2
- package/lib/elements/edges/quadratic.js.map +1 -1
- package/lib/elements/nodes/base-node.d.ts +7 -27
- package/lib/elements/nodes/base-node.js +23 -45
- package/lib/elements/nodes/base-node.js.map +1 -1
- package/lib/elements/nodes/circle.js +2 -2
- package/lib/elements/nodes/circle.js.map +1 -1
- package/lib/elements/nodes/donut.js +2 -1
- package/lib/elements/nodes/donut.js.map +1 -1
- package/lib/elements/nodes/ellipse.js +2 -2
- package/lib/elements/nodes/ellipse.js.map +1 -1
- package/lib/elements/nodes/html.d.ts +2 -1
- package/lib/elements/nodes/html.js +8 -1
- package/lib/elements/nodes/html.js.map +1 -1
- package/lib/elements/nodes/image.js +2 -2
- package/lib/elements/nodes/image.js.map +1 -1
- package/lib/elements/nodes/rect.js +2 -2
- package/lib/elements/nodes/rect.js.map +1 -1
- package/lib/elements/nodes/triangle.js +2 -1
- package/lib/elements/nodes/triangle.js.map +1 -1
- package/lib/elements/shapes/badge.d.ts +1 -1
- package/lib/elements/shapes/badge.js +2 -2
- package/lib/elements/shapes/badge.js.map +1 -1
- package/lib/elements/shapes/base-shape.d.ts +6 -0
- package/lib/elements/shapes/base-shape.js +23 -6
- package/lib/elements/shapes/base-shape.js.map +1 -1
- package/lib/elements/shapes/contour.js +2 -2
- package/lib/elements/shapes/contour.js.map +1 -1
- package/lib/elements/shapes/label.js +2 -2
- package/lib/elements/shapes/label.js.map +1 -1
- package/lib/exports.d.ts +6 -5
- package/lib/exports.js +4 -5
- package/lib/exports.js.map +1 -1
- package/lib/layouts/index.d.ts +1 -1
- package/lib/layouts/index.js +1 -2
- package/lib/layouts/index.js.map +1 -1
- package/lib/layouts/types.d.ts +3 -3
- package/lib/plugins/background/index.d.ts +38 -0
- package/lib/plugins/background/index.js +52 -0
- package/lib/plugins/background/index.js.map +1 -0
- package/lib/plugins/{contextmenu.d.ts → contextmenu/index.d.ts} +5 -5
- package/lib/plugins/{contextmenu.js → contextmenu/index.js} +6 -6
- package/lib/plugins/{contextmenu.js.map → contextmenu/index.js.map} +1 -1
- package/lib/{utils/contextmenu.js → plugins/contextmenu/util.js} +1 -1
- package/lib/{utils/contextmenu.js.map → plugins/contextmenu/util.js.map} +1 -1
- package/lib/plugins/history/index.js +2 -2
- package/lib/plugins/history/index.js.map +1 -1
- package/lib/plugins/history/{utils.js → util.js} +1 -1
- package/lib/plugins/history/util.js.map +1 -0
- package/lib/plugins/index.d.ts +2 -0
- package/lib/plugins/index.js +3 -1
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/timebar.js +1 -1
- package/lib/plugins/timebar.js.map +1 -1
- package/{dist/lib/plugins/watermark.d.ts → lib/plugins/watermark/index.d.ts} +3 -3
- package/lib/plugins/{watermark.js → watermark/index.js} +6 -6
- package/lib/plugins/watermark/index.js.map +1 -0
- package/lib/{utils/watermark.js → plugins/watermark/util.js} +1 -1
- package/lib/plugins/watermark/util.js.map +1 -0
- package/lib/registry/build-in.js +14 -7
- package/lib/registry/build-in.js.map +1 -1
- package/lib/runtime/animation.d.ts +54 -0
- package/lib/runtime/animation.js +143 -0
- package/lib/runtime/animation.js.map +1 -0
- package/lib/runtime/canvas.d.ts +0 -2
- package/lib/runtime/canvas.js +0 -21
- package/lib/runtime/canvas.js.map +1 -1
- package/lib/runtime/data.d.ts +13 -4
- package/lib/runtime/data.js +34 -23
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +27 -41
- package/lib/runtime/element.js +236 -190
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +1 -0
- package/lib/runtime/graph.js +45 -11
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/layout.d.ts +7 -0
- package/lib/runtime/layout.js +43 -2
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/transform.d.ts +1 -0
- package/lib/runtime/transform.js +9 -2
- package/lib/runtime/transform.js.map +1 -1
- package/lib/runtime/types.d.ts +7 -0
- package/lib/runtime/viewport.js +1 -1
- package/lib/runtime/viewport.js.map +1 -1
- package/lib/spec/data.d.ts +14 -0
- package/lib/spec/element/animation.d.ts +3 -9
- package/lib/spec/element/combo.d.ts +4 -3
- package/lib/spec/element/edge.d.ts +4 -3
- package/lib/spec/element/node.d.ts +4 -3
- package/lib/themes/base.js +14 -10
- package/lib/themes/base.js.map +1 -1
- package/lib/transforms/base-transform.d.ts +2 -1
- package/lib/transforms/base-transform.js +1 -1
- package/lib/transforms/base-transform.js.map +1 -1
- package/lib/transforms/collapse-expand-combo.d.ts +4 -3
- package/lib/transforms/collapse-expand-combo.js +13 -29
- package/lib/transforms/collapse-expand-combo.js.map +1 -1
- package/lib/transforms/collapse-expand-node.d.ts +12 -0
- package/lib/transforms/collapse-expand-node.js +95 -0
- package/lib/transforms/collapse-expand-node.js.map +1 -0
- package/lib/transforms/get-edge-actual-ends.d.ts +13 -0
- package/lib/transforms/get-edge-actual-ends.js +41 -0
- package/lib/transforms/get-edge-actual-ends.js.map +1 -0
- package/lib/transforms/index.d.ts +2 -0
- package/lib/transforms/index.js +5 -1
- package/lib/transforms/index.js.map +1 -1
- package/lib/transforms/process-parallel-edges.d.ts +6 -4
- package/lib/transforms/process-parallel-edges.js +41 -26
- package/lib/transforms/process-parallel-edges.js.map +1 -1
- package/lib/transforms/types.d.ts +2 -2
- package/lib/transforms/types.js +0 -12
- package/lib/transforms/types.js.map +1 -1
- package/lib/transforms/update-related-edge.d.ts +2 -1
- package/lib/transforms/update-related-edge.js +4 -1
- package/lib/transforms/update-related-edge.js.map +1 -1
- package/lib/transforms/utils.d.ts +13 -0
- package/lib/transforms/utils.js +29 -0
- package/lib/transforms/utils.js.map +1 -0
- package/lib/types/animation.d.ts +1 -2
- package/lib/types/node.d.ts +24 -0
- package/lib/utils/animation.d.ts +17 -29
- package/lib/utils/animation.js +65 -56
- package/lib/utils/animation.js.map +1 -1
- package/lib/utils/cache.js +0 -1
- package/lib/utils/cache.js.map +1 -1
- package/lib/utils/collapsibility.d.ts +9 -0
- package/lib/utils/collapsibility.js +15 -0
- package/lib/utils/collapsibility.js.map +1 -0
- package/lib/utils/dom.js +1 -2
- package/lib/utils/dom.js.map +1 -1
- package/lib/utils/edge.js +2 -1
- package/lib/utils/edge.js.map +1 -1
- package/lib/utils/element.d.ts +19 -2
- package/lib/utils/element.js +26 -3
- package/lib/utils/element.js.map +1 -1
- package/lib/utils/id.js +2 -4
- package/lib/utils/id.js.map +1 -1
- package/lib/utils/palette.js +16 -8
- package/lib/utils/palette.js.map +1 -1
- package/lib/utils/prefix.d.ts +1 -1
- package/lib/utils/prefix.js +6 -5
- package/lib/utils/prefix.js.map +1 -1
- package/lib/utils/shape.js +1 -1
- package/lib/utils/shape.js.map +1 -1
- package/lib/utils/size.js +2 -3
- package/lib/utils/size.js.map +1 -1
- package/lib/utils/style.d.ts +10 -0
- package/lib/utils/style.js +17 -1
- package/lib/utils/style.js.map +1 -1
- package/lib/utils/theme.d.ts +9 -0
- package/lib/utils/theme.js +21 -0
- package/lib/utils/theme.js.map +1 -0
- package/lib/utils/transform.d.ts +14 -0
- package/lib/utils/transform.js +26 -1
- package/lib/utils/transform.js.map +1 -1
- package/package.json +6 -6
- package/src/animations/executor.ts +39 -61
- package/src/animations/index.ts +19 -15
- package/src/animations/types.ts +82 -27
- package/src/behaviors/{click-element.ts → click-select.ts} +72 -31
- package/src/behaviors/collapse-expand.ts +25 -9
- package/src/behaviors/create-edge.ts +2 -2
- package/src/behaviors/drag-canvas.ts +6 -1
- package/src/behaviors/drag-element.ts +2 -2
- package/src/behaviors/{hover-element.ts → hover-activate.ts} +27 -13
- package/src/behaviors/index.ts +4 -4
- package/src/constants/animation.ts +4 -2
- package/src/constants/events/animation.ts +2 -0
- package/src/constants/events/graph.ts +0 -12
- package/src/elements/base-element.ts +52 -0
- package/src/elements/combos/base-combo.ts +68 -75
- package/src/elements/combos/circle.ts +2 -20
- package/src/elements/combos/rect.ts +1 -2
- package/src/elements/edges/base-edge.ts +62 -49
- 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/line.ts +2 -2
- package/src/elements/edges/polyline.ts +10 -6
- package/src/elements/edges/quadratic.ts +2 -2
- package/src/elements/nodes/base-node.ts +28 -55
- package/src/elements/nodes/circle.ts +2 -2
- package/src/elements/nodes/donut.ts +3 -2
- package/src/elements/nodes/ellipse.ts +2 -2
- package/src/elements/nodes/html.ts +9 -1
- package/src/elements/nodes/image.ts +2 -2
- package/src/elements/nodes/rect.ts +2 -2
- package/src/elements/nodes/triangle.ts +3 -2
- package/src/elements/shapes/badge.ts +2 -2
- package/src/elements/shapes/base-shape.ts +24 -9
- package/src/elements/shapes/contour.ts +2 -2
- package/src/elements/shapes/label.ts +2 -2
- package/src/exports.ts +7 -7
- package/src/layouts/index.ts +0 -1
- package/src/layouts/types.ts +3 -3
- package/src/plugins/background/index.ts +64 -0
- package/src/plugins/{contextmenu.ts → contextmenu/index.ts} +7 -7
- package/src/plugins/history/index.ts +1 -1
- package/src/plugins/index.ts +2 -0
- package/src/plugins/timebar.ts +1 -1
- package/src/plugins/{watermark.ts → watermark/index.ts} +5 -5
- package/src/registry/build-in.ts +26 -12
- package/src/runtime/animation.ts +186 -0
- package/src/runtime/canvas.ts +0 -24
- package/src/runtime/data.ts +36 -24
- package/src/runtime/element.ts +305 -266
- package/src/runtime/graph.ts +45 -11
- package/src/runtime/layout.ts +51 -4
- package/src/runtime/transform.ts +10 -2
- package/src/runtime/types.ts +7 -0
- package/src/runtime/viewport.ts +2 -2
- package/src/spec/data.ts +14 -1
- package/src/spec/element/animation.ts +3 -13
- package/src/spec/element/combo.ts +4 -3
- package/src/spec/element/edge.ts +4 -3
- package/src/spec/element/node.ts +4 -3
- package/src/themes/base.ts +14 -10
- package/src/transforms/base-transform.ts +2 -1
- package/src/transforms/collapse-expand-combo.ts +11 -32
- package/src/transforms/collapse-expand-node.ts +107 -0
- package/src/transforms/get-edge-actual-ends.ts +45 -0
- package/src/transforms/index.ts +2 -0
- package/src/transforms/process-parallel-edges.ts +50 -36
- package/src/transforms/types.ts +5 -5
- package/src/transforms/update-related-edge.ts +5 -1
- package/src/transforms/utils.ts +31 -0
- package/src/types/animation.ts +1 -3
- package/src/types/node.ts +24 -0
- package/src/utils/animation.ts +73 -63
- package/src/utils/cache.ts +0 -1
- package/src/utils/collapsibility.ts +12 -0
- package/src/utils/dom.ts +1 -2
- package/src/utils/edge.ts +2 -1
- package/src/utils/element.ts +28 -3
- package/src/utils/id.ts +2 -4
- package/src/utils/palette.ts +17 -9
- package/src/utils/prefix.ts +8 -7
- package/src/utils/shape.ts +1 -1
- package/src/utils/size.ts +1 -2
- package/src/utils/style.ts +17 -0
- package/src/utils/theme.ts +18 -0
- package/src/utils/transform.ts +33 -0
- package/dist/lib/utils/combo.d.ts +0 -34
- package/esm/behaviors/click-element.js.map +0 -1
- package/esm/behaviors/hover-element.js.map +0 -1
- package/esm/plugins/contextmenu.js.map +0 -1
- package/esm/plugins/history/utils.js.map +0 -1
- package/esm/plugins/watermark.js.map +0 -1
- package/esm/utils/combo.d.ts +0 -34
- package/esm/utils/combo.js +0 -111
- package/esm/utils/combo.js.map +0 -1
- package/esm/utils/watermark.js.map +0 -1
- package/lib/behaviors/click-element.js.map +0 -1
- package/lib/behaviors/hover-element.js.map +0 -1
- package/lib/plugins/history/utils.js.map +0 -1
- package/lib/plugins/watermark.js.map +0 -1
- package/lib/utils/combo.d.ts +0 -34
- package/lib/utils/combo.js +0 -117
- package/lib/utils/combo.js.map +0 -1
- package/lib/utils/watermark.js.map +0 -1
- package/src/utils/combo.ts +0 -134
- /package/dist/lib/{utils/contextmenu.d.ts → plugins/contextmenu/util.d.ts} +0 -0
- /package/dist/lib/plugins/history/{utils.d.ts → util.d.ts} +0 -0
- /package/dist/lib/{utils/watermark.d.ts → plugins/watermark/util.d.ts} +0 -0
- /package/esm/{utils/contextmenu.d.ts → plugins/contextmenu/util.d.ts} +0 -0
- /package/esm/plugins/history/{utils.d.ts → util.d.ts} +0 -0
- /package/esm/{utils/watermark.d.ts → plugins/watermark/util.d.ts} +0 -0
- /package/lib/{utils/contextmenu.d.ts → plugins/contextmenu/util.d.ts} +0 -0
- /package/lib/plugins/history/{utils.d.ts → util.d.ts} +0 -0
- /package/lib/{utils/watermark.d.ts → plugins/watermark/util.d.ts} +0 -0
- /package/src/{utils/contextmenu.ts → plugins/contextmenu/util.ts} +0 -0
- /package/src/plugins/history/{utils.ts → util.ts} +0 -0
- /package/src/{utils/watermark.ts → plugins/watermark/util.ts} +0 -0
|
@@ -27,12 +27,11 @@ export class RectCombo extends BaseCombo<RectComboStyleProps> {
|
|
|
27
27
|
|
|
28
28
|
protected getKeyStyle(attributes: Required<RectComboStyleProps>): GRectStyleProps {
|
|
29
29
|
const keyStyle = super.getKeyStyle(attributes);
|
|
30
|
-
const collapsedStyle = subStyleProps(keyStyle, 'collapsed');
|
|
31
30
|
|
|
32
31
|
const [width, height] = this.getKeySize(attributes);
|
|
33
32
|
return {
|
|
34
33
|
...keyStyle,
|
|
35
|
-
...(attributes.collapsed &&
|
|
34
|
+
...(attributes.collapsed && subStyleProps(keyStyle, 'collapsed')),
|
|
36
35
|
width,
|
|
37
36
|
height,
|
|
38
37
|
x: -width / 2,
|
|
@@ -8,12 +8,13 @@ import type {
|
|
|
8
8
|
} from '@antv/g';
|
|
9
9
|
import { Image, Path } from '@antv/g';
|
|
10
10
|
import type { PathArray } from '@antv/util';
|
|
11
|
-
import {
|
|
11
|
+
import { isFunction } from '@antv/util';
|
|
12
12
|
import type {
|
|
13
13
|
BaseElementStyleProps,
|
|
14
14
|
EdgeArrowStyleProps,
|
|
15
15
|
EdgeKey,
|
|
16
16
|
EdgeLabelStyleProps,
|
|
17
|
+
ID,
|
|
17
18
|
Keyframe,
|
|
18
19
|
LoopStyleProps,
|
|
19
20
|
Node,
|
|
@@ -25,11 +26,12 @@ import { getCubicLoopPath, getLabelPositionStyle } from '../../utils/edge';
|
|
|
25
26
|
import { findPorts, getConnectionPoint, isSameNode } from '../../utils/element';
|
|
26
27
|
import { omitStyleProps, subStyleProps } from '../../utils/prefix';
|
|
27
28
|
import { parseSize } from '../../utils/size';
|
|
29
|
+
import { mergeOptions } from '../../utils/style';
|
|
28
30
|
import * as Symbol from '../../utils/symbol';
|
|
29
31
|
import { getWordWrapWidthByEnds } from '../../utils/text';
|
|
32
|
+
import { BaseElement } from '../base-element';
|
|
30
33
|
import type { LabelStyleProps } from '../shapes';
|
|
31
34
|
import { Label } from '../shapes';
|
|
32
|
-
import { BaseShape } from '../shapes/base-shape';
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
37
|
* <zh/> 边的通用样式属性
|
|
@@ -50,6 +52,13 @@ export interface BaseEdgeStyleProps
|
|
|
50
52
|
* @defaultValue true
|
|
51
53
|
*/
|
|
52
54
|
label?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* <zh/> 是否启用自环边
|
|
57
|
+
*
|
|
58
|
+
* <en/> Whether to enable self-loop edge
|
|
59
|
+
* @defaultValue true
|
|
60
|
+
*/
|
|
61
|
+
loop?: boolean;
|
|
53
62
|
/**
|
|
54
63
|
* <zh/> 是否显示边的光晕
|
|
55
64
|
*
|
|
@@ -84,19 +93,21 @@ export interface BaseEdgeStyleProps
|
|
|
84
93
|
*/
|
|
85
94
|
endArrowOffset?: number;
|
|
86
95
|
/**
|
|
87
|
-
* <zh/> 边的起点
|
|
96
|
+
* <zh/> 边的起点 ID
|
|
88
97
|
*
|
|
89
|
-
* <en/> The
|
|
90
|
-
* @
|
|
98
|
+
* <en/> The ID of the source node
|
|
99
|
+
* @remarks
|
|
100
|
+
* <zh/> 该属性指向物理意义上的起点,由 G6 内部维护,用户无需过多关注。通常情况下,`sourceNode` 与上一级的 `source` 属性一致。但在某些情况下,`sourceNode` 可能会被 G6 内部转换,例如在 Combo 收起时内部节点上的边会自动连接到父 Combo,此时 `sourceNode` 会变更为父 Combo 的 ID。
|
|
101
|
+
*
|
|
102
|
+
* <en/> This property concerning the physical origin, maintained internally by G6. In general, `sourceNode` corresponds to the `source` attribute of the parent level. However, in certain cases, such as when a Combo is collapsed and internal nodes are destroyed, corresponding edges will automatically connect to the parent Combo. At this point, `sourceNode` will be changed to the ID of the parent Combo
|
|
91
103
|
*/
|
|
92
|
-
sourceNode:
|
|
104
|
+
sourceNode: ID;
|
|
93
105
|
/**
|
|
94
106
|
* <zh/> 边的终点 shape
|
|
95
107
|
*
|
|
96
108
|
* <en/> The source shape. Represents the start of the edge
|
|
97
|
-
* @internal
|
|
98
109
|
*/
|
|
99
|
-
targetNode:
|
|
110
|
+
targetNode: ID;
|
|
100
111
|
/**
|
|
101
112
|
* <zh/> 边起始连接的 port
|
|
102
113
|
*
|
|
@@ -157,7 +168,7 @@ type ParsedBaseEdgeStyleProps = Required<BaseEdgeStyleProps>;
|
|
|
157
168
|
*
|
|
158
169
|
* <en/> Base class of the edge
|
|
159
170
|
*/
|
|
160
|
-
export abstract class BaseEdge extends
|
|
171
|
+
export abstract class BaseEdge extends BaseElement<BaseEdgeStyleProps> {
|
|
161
172
|
public type = 'edge';
|
|
162
173
|
|
|
163
174
|
static defaultStyleProps: Partial<BaseEdgeStyleProps> = {
|
|
@@ -178,6 +189,7 @@ export abstract class BaseEdge extends BaseShape<BaseEdgeStyleProps> {
|
|
|
178
189
|
haloPointerEvents: 'none',
|
|
179
190
|
haloStrokeOpacity: 0.25,
|
|
180
191
|
haloZIndex: -1,
|
|
192
|
+
loop: true,
|
|
181
193
|
startArrow: false,
|
|
182
194
|
startArrowSize: 8,
|
|
183
195
|
startArrowLineDash: 0,
|
|
@@ -195,13 +207,25 @@ export abstract class BaseEdge extends BaseShape<BaseEdgeStyleProps> {
|
|
|
195
207
|
};
|
|
196
208
|
|
|
197
209
|
constructor(options: DisplayObjectConfig<BaseEdgeStyleProps>) {
|
|
198
|
-
super(
|
|
210
|
+
super(mergeOptions({ style: BaseEdge.defaultStyleProps }, options));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
protected get sourceNode() {
|
|
214
|
+
const { context, sourceNode: source } = this.parsedAttributes;
|
|
215
|
+
return context.element!.getElement<Node>(source)!;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
protected get targetNode() {
|
|
219
|
+
const { context, targetNode: target } = this.parsedAttributes;
|
|
220
|
+
return context.element!.getElement<Node>(target)!;
|
|
199
221
|
}
|
|
200
222
|
|
|
201
223
|
protected getKeyStyle(attributes: ParsedBaseEdgeStyleProps): PathStyleProps {
|
|
202
|
-
const {
|
|
224
|
+
const { loop, ...style } = this.getGraphicStyle(attributes);
|
|
225
|
+
const { sourceNode, targetNode } = this;
|
|
226
|
+
|
|
227
|
+
const d = loop && isSameNode(sourceNode, targetNode) ? this.getLoopPath(attributes) : this.getKeyPath(attributes);
|
|
203
228
|
|
|
204
|
-
const d = isSameNode(sourceNode, targetNode) ? this.getLoopPath(attributes) : this.getKeyPath(attributes);
|
|
205
229
|
return {
|
|
206
230
|
d,
|
|
207
231
|
...omitStyleProps(style, ['halo', 'label', 'startArrow', 'endArrow']),
|
|
@@ -211,7 +235,8 @@ export abstract class BaseEdge extends BaseShape<BaseEdgeStyleProps> {
|
|
|
211
235
|
protected abstract getKeyPath(attributes: ParsedBaseEdgeStyleProps): PathArray;
|
|
212
236
|
|
|
213
237
|
protected getLoopPath(attributes: ParsedBaseEdgeStyleProps): PathArray {
|
|
214
|
-
const {
|
|
238
|
+
const { sourcePort, targetPort } = attributes;
|
|
239
|
+
const node = this.sourceNode;
|
|
215
240
|
|
|
216
241
|
const bbox = getNodeBBox(node);
|
|
217
242
|
const defaultDist = Math.max(getBBoxWidth(bbox), getBBoxHeight(bbox));
|
|
@@ -226,7 +251,8 @@ export abstract class BaseEdge extends BaseShape<BaseEdgeStyleProps> {
|
|
|
226
251
|
}
|
|
227
252
|
|
|
228
253
|
protected getEndpoints(attributes: ParsedBaseEdgeStyleProps): [Point, Point] {
|
|
229
|
-
const {
|
|
254
|
+
const { sourcePort: sourcePortKey, targetPort: targetPortKey } = attributes;
|
|
255
|
+
const { sourceNode, targetNode } = this;
|
|
230
256
|
|
|
231
257
|
const [sourcePort, targetPort] = findPorts(sourceNode, targetNode, sourcePortKey, targetPortKey);
|
|
232
258
|
|
|
@@ -246,7 +272,7 @@ export abstract class BaseEdge extends BaseShape<BaseEdgeStyleProps> {
|
|
|
246
272
|
}
|
|
247
273
|
|
|
248
274
|
protected getLabelStyle(attributes: ParsedBaseEdgeStyleProps): false | LabelStyleProps {
|
|
249
|
-
if (attributes.label === false ||
|
|
275
|
+
if (attributes.label === false || !attributes.labelText) return false;
|
|
250
276
|
|
|
251
277
|
const labelStyle = subStyleProps<Required<EdgeLabelStyleProps>>(this.getGraphicStyle(attributes), 'label');
|
|
252
278
|
const { placement, offsetX, offsetY, autoRotate, maxWidth, ...restStyle } = labelStyle;
|
|
@@ -273,12 +299,12 @@ export abstract class BaseEdge extends BaseShape<BaseEdgeStyleProps> {
|
|
|
273
299
|
|
|
274
300
|
if (enable) {
|
|
275
301
|
const arrowStyle = this.getArrowStyle(attributes, isStart);
|
|
276
|
-
const Ctor =
|
|
302
|
+
const Ctor = arrowStyle.src ? Image : Path;
|
|
277
303
|
const [marker, markerOffset, arrowOffset] = isStart
|
|
278
304
|
? (['markerStart', 'markerStartOffset', 'startArrowOffset'] as const)
|
|
279
305
|
: (['markerEnd', 'markerEndOffset', 'endArrowOffset'] as const);
|
|
280
306
|
|
|
281
|
-
const arrow = keyShape.
|
|
307
|
+
const arrow = keyShape.parsedStyle[marker];
|
|
282
308
|
// update
|
|
283
309
|
if (arrow) arrow.attr(arrowStyle);
|
|
284
310
|
// create
|
|
@@ -340,39 +366,26 @@ export abstract class BaseEdge extends BaseShape<BaseEdgeStyleProps> {
|
|
|
340
366
|
this.drawHaloShape(attributes, container);
|
|
341
367
|
}
|
|
342
368
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
*/
|
|
349
|
-
public onCreate() {}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* <zh/> 在元素更新并执行完过渡动画后调用
|
|
353
|
-
*
|
|
354
|
-
* <en/> Called after the element is updated and the transition animation is completed
|
|
355
|
-
* @override
|
|
356
|
-
*/
|
|
357
|
-
public onUpdate() {}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* <zh/> 在元素完成退场动画并销毁后调用
|
|
361
|
-
*
|
|
362
|
-
* <en/> Called after the element completes the exit animation and is destroyed
|
|
363
|
-
* @override
|
|
364
|
-
*/
|
|
365
|
-
public onDestroy() {}
|
|
369
|
+
protected onframe() {
|
|
370
|
+
this.drawKeyShape(this.parsedAttributes, this);
|
|
371
|
+
this.drawHaloShape(this.parsedAttributes, this);
|
|
372
|
+
this.drawLabelShape(this.parsedAttributes, this);
|
|
373
|
+
}
|
|
366
374
|
|
|
367
375
|
public animate(keyframes: Keyframe[], options?: number | KeyframeAnimationOptions) {
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
if (
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
376
|
+
const animation = super.animate(keyframes, options);
|
|
377
|
+
|
|
378
|
+
if (!animation) return animation;
|
|
379
|
+
|
|
380
|
+
// 设置 currentTime 时触发更新
|
|
381
|
+
// Trigger update when setting currentTime
|
|
382
|
+
return new Proxy(animation, {
|
|
383
|
+
set: (target, propKey, value) => {
|
|
384
|
+
// 需要推迟 onframe 调用时机,等待节点位置更新完成
|
|
385
|
+
// Need to delay the timing of the onframe call, wait for the node position update to complete
|
|
386
|
+
if (propKey === 'currentTime') Promise.resolve().then(() => this.onframe());
|
|
387
|
+
return Reflect.set(target, propKey, value);
|
|
388
|
+
},
|
|
389
|
+
});
|
|
377
390
|
}
|
|
378
391
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DisplayObjectConfig } from '@antv/g';
|
|
2
|
-
import { deepMix } from '@antv/util';
|
|
3
2
|
import type { Point } from '../../types';
|
|
3
|
+
import { mergeOptions } from '../../utils/style';
|
|
4
4
|
import type { BaseEdgeStyleProps } from './base-edge';
|
|
5
5
|
import { Cubic } from './cubic';
|
|
6
6
|
|
|
@@ -42,7 +42,7 @@ export class CubicHorizontal extends Cubic {
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
constructor(options: DisplayObjectConfig<CubicHorizontalStyleProps>) {
|
|
45
|
-
super(
|
|
45
|
+
super(mergeOptions({ style: CubicHorizontal.defaultStyleProps }, options));
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
protected getControlPoints(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DisplayObjectConfig } from '@antv/g';
|
|
2
|
-
import { deepMix } from '@antv/util';
|
|
3
2
|
import type { Point } from '../../types';
|
|
3
|
+
import { mergeOptions } from '../../utils/style';
|
|
4
4
|
import type { BaseEdgeStyleProps } from './base-edge';
|
|
5
5
|
import { Cubic } from './cubic';
|
|
6
6
|
|
|
@@ -42,7 +42,7 @@ export class CubicVertical extends Cubic {
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
constructor(options: DisplayObjectConfig<CubicVerticalStyleProps>) {
|
|
45
|
-
super(
|
|
45
|
+
super(mergeOptions({ style: CubicVertical.defaultStyleProps }, options));
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
protected getControlPoints(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DisplayObjectConfig } from '@antv/g';
|
|
2
2
|
import type { PathArray } from '@antv/util';
|
|
3
|
-
import { deepMix } from '@antv/util';
|
|
4
3
|
import type { Point } from '../../types';
|
|
5
4
|
import { getCubicPath, getCurveControlPoint, parseCurveOffset, parseCurvePosition } from '../../utils/edge';
|
|
5
|
+
import { mergeOptions } from '../../utils/style';
|
|
6
6
|
import type { BaseEdgeStyleProps } from './base-edge';
|
|
7
7
|
import { BaseEdge } from './base-edge';
|
|
8
8
|
|
|
@@ -48,7 +48,7 @@ export class Cubic extends BaseEdge {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
constructor(options: DisplayObjectConfig<CubicStyleProps>) {
|
|
51
|
-
super(
|
|
51
|
+
super(mergeOptions({ style: Cubic.defaultStyleProps }, options));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DisplayObjectConfig } from '@antv/g';
|
|
2
2
|
import type { PathArray } from '@antv/util';
|
|
3
|
-
import {
|
|
3
|
+
import { mergeOptions } from '../../utils/style';
|
|
4
4
|
import type { BaseEdgeStyleProps } from './base-edge';
|
|
5
5
|
import { BaseEdge } from './base-edge';
|
|
6
6
|
|
|
@@ -24,7 +24,7 @@ export class Line extends BaseEdge {
|
|
|
24
24
|
static defaultStyleProps: Partial<LineStyleProps> = {};
|
|
25
25
|
|
|
26
26
|
constructor(options: DisplayObjectConfig<LineStyleProps>) {
|
|
27
|
-
super(
|
|
27
|
+
super(mergeOptions({ style: Line.defaultStyleProps }, options));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
protected getKeyPath(attributes: ParsedLineStyleProps): PathArray {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { DisplayObjectConfig } from '@antv/g';
|
|
2
2
|
import type { PathArray } from '@antv/util';
|
|
3
|
-
import { deepMix } from '@antv/util';
|
|
4
3
|
import type { LoopStyleProps, Padding, Point, Port } from '../../types';
|
|
5
4
|
import { getBBoxHeight, getBBoxWidth, getNodeBBox } from '../../utils/bbox';
|
|
6
5
|
import { getPolylineLoopPath, getPolylinePath } from '../../utils/edge';
|
|
7
6
|
import { findPorts, getConnectionPoint, getPortPosition } from '../../utils/element';
|
|
8
7
|
import { subStyleProps } from '../../utils/prefix';
|
|
9
8
|
import { orth } from '../../utils/router/orth';
|
|
9
|
+
import { mergeOptions } from '../../utils/style';
|
|
10
10
|
import type { BaseEdgeStyleProps } from './base-edge';
|
|
11
11
|
import { BaseEdge } from './base-edge';
|
|
12
12
|
|
|
@@ -70,11 +70,12 @@ export class Polyline extends BaseEdge {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
constructor(options: DisplayObjectConfig<PolylineStyleProps>) {
|
|
73
|
-
super(
|
|
73
|
+
super(mergeOptions({ style: Polyline.defaultStyleProps }, options));
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
protected getKeyPath(attributes: ParsedPolylineStyleProps): PathArray {
|
|
77
|
-
const {
|
|
77
|
+
const { radius } = attributes;
|
|
78
|
+
const { sourceNode, targetNode } = this;
|
|
78
79
|
// 1. 获取连接点(若有连接桩,取连接桩中心;反之,取节点中心)和连接桩 | Get connection points (if port, take port center; otherwise, take node center) and ports
|
|
79
80
|
const { sourcePoint, targetPoint, sourcePort, targetPort } = this.getEndpointsAndPorts(attributes);
|
|
80
81
|
|
|
@@ -98,7 +99,8 @@ export class Polyline extends BaseEdge {
|
|
|
98
99
|
sourcePort: Port | undefined;
|
|
99
100
|
targetPort: Port | undefined;
|
|
100
101
|
} {
|
|
101
|
-
const {
|
|
102
|
+
const { sourcePort: sourcePortKey, targetPort: targetPortKey } = attributes;
|
|
103
|
+
const { sourceNode, targetNode } = this;
|
|
102
104
|
|
|
103
105
|
const [sourcePort, targetPort] = findPorts(sourceNode, targetNode, sourcePortKey, targetPortKey);
|
|
104
106
|
|
|
@@ -111,7 +113,8 @@ export class Polyline extends BaseEdge {
|
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
protected getControlPoints(attributes: ParsedPolylineStyleProps, sourcePoint: Point, targetPoint: Point): Point[] {
|
|
114
|
-
const { controlPoints,
|
|
116
|
+
const { controlPoints, router, routerPadding } = attributes;
|
|
117
|
+
const { sourceNode, targetNode } = this;
|
|
115
118
|
|
|
116
119
|
if (!router) return [...controlPoints];
|
|
117
120
|
|
|
@@ -122,7 +125,8 @@ export class Polyline extends BaseEdge {
|
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
protected getLoopPath(attributes: ParsedPolylineStyleProps): PathArray {
|
|
125
|
-
const {
|
|
128
|
+
const { sourcePort: sourcePortKey, targetPort: targetPortKey, radius } = attributes;
|
|
129
|
+
const node = this.sourceNode;
|
|
126
130
|
|
|
127
131
|
const bbox = getNodeBBox(node);
|
|
128
132
|
// 默认转折点距离为 bbox 的最大宽高的 1/4 | Default distance of the turning point is 1/4 of the maximum width and height of the bbox
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DisplayObjectConfig } from '@antv/g';
|
|
2
2
|
import type { PathArray } from '@antv/util';
|
|
3
|
-
import { deepMix } from '@antv/util';
|
|
4
3
|
import type { Point } from '../../types';
|
|
5
4
|
import { getCurveControlPoint, getQuadraticPath } from '../../utils/edge';
|
|
5
|
+
import { mergeOptions } from '../../utils/style';
|
|
6
6
|
import type { BaseEdgeStyleProps } from './base-edge';
|
|
7
7
|
import { BaseEdge } from './base-edge';
|
|
8
8
|
|
|
@@ -48,7 +48,7 @@ export class Quadratic extends BaseEdge {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
constructor(options: DisplayObjectConfig<QuadraticStyleProps>) {
|
|
51
|
-
super(
|
|
51
|
+
super(mergeOptions({ style: Quadratic.defaultStyleProps }, options));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
protected getKeyPath(attributes: ParsedQuadraticStyleProps): PathArray {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { BaseStyleProps, DisplayObject, DisplayObjectConfig, Group } from '@antv/g';
|
|
2
2
|
import { Circle as GCircle } from '@antv/g';
|
|
3
|
-
import { deepMix, isEmpty } from '@antv/util';
|
|
4
3
|
import type { CategoricalPalette } from '../../palettes/types';
|
|
5
4
|
import type { NodeData } from '../../spec';
|
|
6
5
|
import type {
|
|
7
6
|
BaseElementStyleProps,
|
|
8
|
-
|
|
9
|
-
Node,
|
|
7
|
+
ID,
|
|
10
8
|
NodeBadgeStyleProps,
|
|
11
9
|
NodeLabelStyleProps,
|
|
12
10
|
NodePortStyleProps,
|
|
@@ -23,10 +21,12 @@ import { getRectIntersectPoint } from '../../utils/point';
|
|
|
23
21
|
import { getXYByPlacement } from '../../utils/position';
|
|
24
22
|
import { omitStyleProps, subObject, subStyleProps } from '../../utils/prefix';
|
|
25
23
|
import { parseSize } from '../../utils/size';
|
|
24
|
+
import { mergeOptions } from '../../utils/style';
|
|
26
25
|
import { getWordWrapWidthByBox } from '../../utils/text';
|
|
27
26
|
import { replaceTranslateInTransform } from '../../utils/transform';
|
|
27
|
+
import { BaseElement } from '../base-element';
|
|
28
28
|
import type { BadgeStyleProps, IconStyleProps, LabelStyleProps } from '../shapes';
|
|
29
|
-
import { Badge,
|
|
29
|
+
import { Badge, Icon, Label } from '../shapes';
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* <zh/> 节点通用样式配置项
|
|
@@ -83,7 +83,7 @@ export interface BaseNodeStyleProps
|
|
|
83
83
|
*
|
|
84
84
|
* <en/> Only valid in the tree graph
|
|
85
85
|
*/
|
|
86
|
-
childrenNode?:
|
|
86
|
+
childrenNode?: ID[];
|
|
87
87
|
/**
|
|
88
88
|
* <zh/> 子节点数据
|
|
89
89
|
*
|
|
@@ -184,7 +184,7 @@ export interface BaseNodeStyleProps
|
|
|
184
184
|
*
|
|
185
185
|
* <en/> Design document: https://www.yuque.com/antv/g6/gl1iof1xpzg6ed98
|
|
186
186
|
*/
|
|
187
|
-
export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps> extends
|
|
187
|
+
export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps> extends BaseElement<S> {
|
|
188
188
|
public type = 'node';
|
|
189
189
|
|
|
190
190
|
static defaultStyleProps: Partial<BaseNodeStyleProps> = {
|
|
@@ -218,11 +218,7 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
218
218
|
};
|
|
219
219
|
|
|
220
220
|
constructor(options: DisplayObjectConfig<S>) {
|
|
221
|
-
super(
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
public get parsedAttributes() {
|
|
225
|
-
return this.attributes as Required<S>;
|
|
221
|
+
super(mergeOptions({ style: BaseNode.defaultStyleProps }, options));
|
|
226
222
|
}
|
|
227
223
|
|
|
228
224
|
protected getSize(attributes = this.attributes) {
|
|
@@ -237,9 +233,9 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
237
233
|
}
|
|
238
234
|
|
|
239
235
|
protected getLabelStyle(attributes: Required<S>): false | LabelStyleProps {
|
|
240
|
-
if (attributes.label === false ||
|
|
236
|
+
if (attributes.label === false || !attributes.labelText) return false;
|
|
241
237
|
|
|
242
|
-
const { placement, maxWidth, ...labelStyle } = subStyleProps<Required<NodeLabelStyleProps>>(
|
|
238
|
+
const { placement, maxWidth, offsetX, offsetY, ...labelStyle } = subStyleProps<Required<NodeLabelStyleProps>>(
|
|
243
239
|
this.getGraphicStyle(attributes),
|
|
244
240
|
'label',
|
|
245
241
|
);
|
|
@@ -247,7 +243,7 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
247
243
|
const keyBounds = keyShape.getLocalBounds();
|
|
248
244
|
|
|
249
245
|
return Object.assign(
|
|
250
|
-
getTextStyleByPlacement(keyBounds, placement),
|
|
246
|
+
getTextStyleByPlacement(keyBounds, placement, offsetX, offsetY),
|
|
251
247
|
{ wordWrapWidth: getWordWrapWidthByBox(keyBounds, maxWidth) },
|
|
252
248
|
labelStyle,
|
|
253
249
|
);
|
|
@@ -263,7 +259,7 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
263
259
|
}
|
|
264
260
|
|
|
265
261
|
protected getIconStyle(attributes: Required<S>): false | IconStyleProps {
|
|
266
|
-
if (attributes.icon === false ||
|
|
262
|
+
if (attributes.icon === false || (!attributes.iconText && !attributes.iconSrc)) return false;
|
|
267
263
|
|
|
268
264
|
const iconStyle = subStyleProps(this.getGraphicStyle(attributes), 'icon');
|
|
269
265
|
const keyShape = this.getKey();
|
|
@@ -279,7 +275,7 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
279
275
|
Object.keys(badges).forEach((key) => {
|
|
280
276
|
badgesShapeStyle[key] = false;
|
|
281
277
|
});
|
|
282
|
-
if (attributes.badge === false ||
|
|
278
|
+
if (attributes.badge === false || !attributes.badges?.length) return badgesShapeStyle;
|
|
283
279
|
|
|
284
280
|
const { badges: badgeOptions = [], badgePalette, opacity = 1, ...restAttributes } = attributes;
|
|
285
281
|
const colors = getPaletteColors(badgePalette);
|
|
@@ -299,8 +295,8 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
299
295
|
|
|
300
296
|
protected getBadgeStyle(style: NodeBadgeStyleProps): NodeBadgeStyleProps {
|
|
301
297
|
const keyShape = this.getKey();
|
|
302
|
-
const { placement = 'top', ...restStyle } = style;
|
|
303
|
-
const textStyle = getTextStyleByPlacement(keyShape.getLocalBounds(), placement, true);
|
|
298
|
+
const { placement = 'top', offsetX, offsetY, ...restStyle } = style;
|
|
299
|
+
const textStyle = getTextStyleByPlacement(keyShape.getLocalBounds(), placement, offsetX, offsetY, true);
|
|
304
300
|
return { ...textStyle, ...restStyle };
|
|
305
301
|
}
|
|
306
302
|
|
|
@@ -312,7 +308,7 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
312
308
|
portsShapeStyle[key] = false;
|
|
313
309
|
});
|
|
314
310
|
|
|
315
|
-
if (attributes.port === false ||
|
|
311
|
+
if (attributes.port === false || !attributes.ports?.length) return portsShapeStyle;
|
|
316
312
|
|
|
317
313
|
const portStyle = subStyleProps<PortStyleProps>(this.getGraphicStyle(attributes), 'port');
|
|
318
314
|
const { ports: portOptions = [] } = attributes;
|
|
@@ -379,6 +375,10 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
379
375
|
);
|
|
380
376
|
}
|
|
381
377
|
|
|
378
|
+
protected drawIconShape(attributes: Required<S>, container: Group): void {
|
|
379
|
+
this.upsert('icon', Icon, this.getIconStyle(attributes), container);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
382
|
protected drawBadgeShapes(attributes: Required<S>, container: Group): void {
|
|
383
383
|
const badgesStyle = this.getBadgesStyle(attributes);
|
|
384
384
|
Object.keys(badgesStyle).forEach((key) => {
|
|
@@ -393,6 +393,10 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
393
393
|
});
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
+
protected drawLabelShape(attributes: Required<S>, container: Group): void {
|
|
397
|
+
this.upsert('label', Label, this.getLabelStyle(attributes), container);
|
|
398
|
+
}
|
|
399
|
+
|
|
396
400
|
protected abstract drawKeyShape(attributes: Required<S>, container: Group): DisplayObject | undefined;
|
|
397
401
|
|
|
398
402
|
public render(attributes = this.parsedAttributes, container: Group = this) {
|
|
@@ -410,51 +414,20 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
410
414
|
this.drawHaloShape(attributes, container);
|
|
411
415
|
|
|
412
416
|
// 3. icon
|
|
413
|
-
this.
|
|
417
|
+
this.drawIconShape(attributes, container);
|
|
414
418
|
|
|
415
419
|
// 4. badges
|
|
416
420
|
this.drawBadgeShapes(attributes, container);
|
|
417
421
|
|
|
418
422
|
// 5. label
|
|
419
|
-
this.
|
|
423
|
+
this.drawLabelShape(attributes, container);
|
|
420
424
|
|
|
421
425
|
// 6. ports
|
|
422
426
|
this.drawPortShapes(attributes, container);
|
|
423
427
|
}
|
|
424
428
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
* <en/> Called after the element is created and the entrance animation is completed
|
|
429
|
-
* @override
|
|
430
|
-
*/
|
|
431
|
-
public onCreate() {}
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* <zh/> 在元素更新并执行完过渡动画后调用
|
|
435
|
-
*
|
|
436
|
-
* <en/> Called after the element is updated and the transition animation is completed
|
|
437
|
-
* @override
|
|
438
|
-
*/
|
|
439
|
-
public onUpdate() {}
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* <zh/> 在元素完成退场动画并销毁后调用
|
|
443
|
-
*
|
|
444
|
-
* <en/> Called after the element completes the exit animation and is destroyed
|
|
445
|
-
* @override
|
|
446
|
-
*/
|
|
447
|
-
public onDestroy() {}
|
|
448
|
-
|
|
449
|
-
public animate(keyframes: Keyframe[], options?: number | KeyframeAnimationOptions) {
|
|
450
|
-
const result = super.animate(keyframes, options);
|
|
451
|
-
|
|
452
|
-
if (result) {
|
|
453
|
-
result.onframe = () => {
|
|
454
|
-
this.drawBadgeShapes(this.parsedAttributes, this);
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
return result;
|
|
429
|
+
protected onframe() {
|
|
430
|
+
this.drawBadgeShapes(this.parsedAttributes, this);
|
|
431
|
+
this.drawLabelShape(this.parsedAttributes, this);
|
|
459
432
|
}
|
|
460
433
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DisplayObjectConfig, CircleStyleProps as GCircleStyleProps, Group } from '@antv/g';
|
|
2
2
|
import { Circle as GCircle } from '@antv/g';
|
|
3
|
-
import { deepMix } from '@antv/util';
|
|
4
3
|
import { ICON_SIZE_RATIO } from '../../constants/element';
|
|
5
4
|
import type { Point } from '../../types';
|
|
6
5
|
import { getEllipseIntersectPoint } from '../../utils/point';
|
|
6
|
+
import { mergeOptions } from '../../utils/style';
|
|
7
7
|
import type { IconStyleProps } from '../shapes';
|
|
8
8
|
import type { BaseNodeStyleProps } from './base-node';
|
|
9
9
|
import { BaseNode } from './base-node';
|
|
@@ -26,7 +26,7 @@ export class Circle extends BaseNode {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
constructor(options: DisplayObjectConfig<CircleStyleProps>) {
|
|
29
|
-
super(
|
|
29
|
+
super(mergeOptions({ style: Circle.defaultStyleProps }, options));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
protected drawKeyShape(attributes: Required<CircleStyleProps>, container: Group) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Path } from '@antv/g';
|
|
2
|
-
import {
|
|
2
|
+
import { isNumber, isString } from '@antv/util';
|
|
3
3
|
import { getPaletteColors } from '../../utils/palette';
|
|
4
4
|
import { subStyleProps } from '../../utils/prefix';
|
|
5
5
|
import { parseSize } from '../../utils/size';
|
|
@@ -8,6 +8,7 @@ import { Circle } from './circle';
|
|
|
8
8
|
import type { BaseStyleProps, DisplayObjectConfig, Group } from '@antv/g';
|
|
9
9
|
import type { CategoricalPalette } from '../../palettes/types';
|
|
10
10
|
import type { DonutRound, Prefix } from '../../types';
|
|
11
|
+
import { mergeOptions } from '../../utils/style';
|
|
11
12
|
import type { CircleStyleProps } from './circle';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -51,7 +52,7 @@ export class Donut extends Circle {
|
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
constructor(options: DisplayObjectConfig<DonutStyleProps>) {
|
|
54
|
-
super(
|
|
55
|
+
super(mergeOptions({ style: Donut.defaultStyleProps }, options));
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
private parseOuterR() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DisplayObjectConfig, EllipseStyleProps as GEllipseStyleProps, Group } from '@antv/g';
|
|
2
2
|
import { Ellipse as GEllipse } from '@antv/g';
|
|
3
|
-
import { deepMix } from '@antv/util';
|
|
4
3
|
import { ICON_SIZE_RATIO } from '../../constants/element';
|
|
5
4
|
import type { Point } from '../../types';
|
|
6
5
|
import { getEllipseIntersectPoint } from '../../utils/point';
|
|
6
|
+
import { mergeOptions } from '../../utils/style';
|
|
7
7
|
import type { IconStyleProps } from '../shapes';
|
|
8
8
|
import type { BaseNodeStyleProps } from './base-node';
|
|
9
9
|
import { BaseNode } from './base-node';
|
|
@@ -26,7 +26,7 @@ export class Ellipse extends BaseNode {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
constructor(options: DisplayObjectConfig<EllipseStyleProps>) {
|
|
29
|
-
super(
|
|
29
|
+
super(mergeOptions({ style: Ellipse.defaultStyleProps }, options));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
protected drawKeyShape(attributes: Required<EllipseStyleProps>, container: Group) {
|
|
@@ -95,12 +95,13 @@ export class HTML extends BaseNode<HTMLStyleProps> {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
public
|
|
98
|
+
public destroy() {
|
|
99
99
|
const element = this.getDomElement();
|
|
100
100
|
this.events.forEach((eventName) => {
|
|
101
101
|
// @ts-expect-error assert event is PointerEvent
|
|
102
102
|
element.removeEventListener(eventName, this.forwardEvents);
|
|
103
103
|
});
|
|
104
|
+
super.destroy();
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
private forwardEvents = (nativeEvent: PointerEvent) => {
|
|
@@ -245,4 +246,11 @@ export class HTML extends BaseNode<HTMLStyleProps> {
|
|
|
245
246
|
}
|
|
246
247
|
return { x, y };
|
|
247
248
|
}
|
|
249
|
+
|
|
250
|
+
protected onframe(): void {
|
|
251
|
+
super.onframe();
|
|
252
|
+
// sync opacity
|
|
253
|
+
const { opacity } = this.attributes;
|
|
254
|
+
this.getDomElement().style.opacity = `${opacity}`;
|
|
255
|
+
}
|
|
248
256
|
}
|