(
node: TreeNode,
data: SeriesData,
group: graphic.Group,
seriesModel: TreeSeriesModel,
removeAnimationOpt: AnimationOption
)
| 559 | } |
| 560 | |
| 561 | function removeNodeEdge( |
| 562 | node: TreeNode, |
| 563 | data: SeriesData, |
| 564 | group: graphic.Group, |
| 565 | seriesModel: TreeSeriesModel, |
| 566 | removeAnimationOpt: AnimationOption |
| 567 | ) { |
| 568 | const virtualRoot = data.tree.root; |
| 569 | const { source, sourceLayout } = getSourceNode(virtualRoot, node); |
| 570 | |
| 571 | const symbolEl: TreeSymbol = data.getItemGraphicEl(node.dataIndex) as TreeSymbol; |
| 572 | |
| 573 | if (!symbolEl) { |
| 574 | return; |
| 575 | } |
| 576 | |
| 577 | const sourceSymbolEl = data.getItemGraphicEl(source.dataIndex) as TreeSymbol; |
| 578 | const sourceEdge = sourceSymbolEl.__edge; |
| 579 | |
| 580 | // 1. when expand the sub tree, delete the children node should delete the edge of |
| 581 | // the source at the same time. because the polyline edge shape is only owned by the source. |
| 582 | // 2.when the node is the only children of the source, delete the node should delete the edge of |
| 583 | // the source at the same time. the same reason as above. |
| 584 | const edge = symbolEl.__edge |
| 585 | || ((source.isExpand === false || source.children.length === 1) ? sourceEdge : undefined); |
| 586 | |
| 587 | const edgeShape = seriesModel.get('edgeShape'); |
| 588 | const layoutOpt = seriesModel.get('layout'); |
| 589 | const orient = seriesModel.get('orient'); |
| 590 | const curvature = seriesModel.get(['lineStyle', 'curveness']); |
| 591 | |
| 592 | if (edge) { |
| 593 | if (edgeShape === 'curve') { |
| 594 | graphic.removeElement(edge as Path, { |
| 595 | shape: getEdgeShape( |
| 596 | layoutOpt, |
| 597 | orient, |
| 598 | curvature, |
| 599 | sourceLayout, |
| 600 | sourceLayout |
| 601 | ), |
| 602 | style: { |
| 603 | opacity: 0 |
| 604 | } |
| 605 | }, seriesModel, { |
| 606 | cb() { |
| 607 | group.remove(edge); |
| 608 | }, |
| 609 | removeOpt: removeAnimationOpt |
| 610 | }); |
| 611 | } |
| 612 | else if (edgeShape === 'polyline' && seriesModel.get('layout') === 'orthogonal') { |
| 613 | graphic.removeElement(edge as Path, { |
| 614 | shape: { |
| 615 | parentPoint: [sourceLayout.x, sourceLayout.y], |
| 616 | childPoints: [[sourceLayout.x, sourceLayout.y]] |
| 617 | }, |
| 618 | style: { |
no test coverage detected
searching dependent graphs…