(
layoutOpt: TreeSeriesOption['layout'],
orient: TreeSeriesOption['orient'],
curvature: number,
sourceLayout: TreeNodeLayout,
targetLayout: TreeNodeLayout
)
| 683 | } |
| 684 | |
| 685 | function getEdgeShape( |
| 686 | layoutOpt: TreeSeriesOption['layout'], |
| 687 | orient: TreeSeriesOption['orient'], |
| 688 | curvature: number, |
| 689 | sourceLayout: TreeNodeLayout, |
| 690 | targetLayout: TreeNodeLayout |
| 691 | ) { |
| 692 | let cpx1: number; |
| 693 | let cpy1: number; |
| 694 | let cpx2: number; |
| 695 | let cpy2: number; |
| 696 | let x1: number; |
| 697 | let x2: number; |
| 698 | let y1: number; |
| 699 | let y2: number; |
| 700 | |
| 701 | if (layoutOpt === 'radial') { |
| 702 | x1 = sourceLayout.rawX; |
| 703 | y1 = sourceLayout.rawY; |
| 704 | x2 = targetLayout.rawX; |
| 705 | y2 = targetLayout.rawY; |
| 706 | |
| 707 | const radialCoor1 = radialCoordinate(x1, y1); |
| 708 | const radialCoor2 = radialCoordinate(x1, y1 + (y2 - y1) * curvature); |
| 709 | const radialCoor3 = radialCoordinate(x2, y2 + (y1 - y2) * curvature); |
| 710 | const radialCoor4 = radialCoordinate(x2, y2); |
| 711 | |
| 712 | return { |
| 713 | x1: radialCoor1.x || 0, |
| 714 | y1: radialCoor1.y || 0, |
| 715 | x2: radialCoor4.x || 0, |
| 716 | y2: radialCoor4.y || 0, |
| 717 | cpx1: radialCoor2.x || 0, |
| 718 | cpy1: radialCoor2.y || 0, |
| 719 | cpx2: radialCoor3.x || 0, |
| 720 | cpy2: radialCoor3.y || 0 |
| 721 | }; |
| 722 | } |
| 723 | else { |
| 724 | x1 = sourceLayout.x; |
| 725 | y1 = sourceLayout.y; |
| 726 | x2 = targetLayout.x; |
| 727 | y2 = targetLayout.y; |
| 728 | |
| 729 | if (orient === 'LR' || orient === 'RL') { |
| 730 | cpx1 = x1 + (x2 - x1) * curvature; |
| 731 | cpy1 = y1; |
| 732 | cpx2 = x2 + (x1 - x2) * curvature; |
| 733 | cpy2 = y2; |
| 734 | } |
| 735 | if (orient === 'TB' || orient === 'BT') { |
| 736 | cpx1 = x1; |
| 737 | cpy1 = y1 + (y2 - y1) * curvature; |
| 738 | cpx2 = x2; |
| 739 | cpy2 = y2 + (y1 - y2) * curvature; |
| 740 | } |
| 741 | } |
| 742 |
no test coverage detected