Skip to content

Commit 8c7ee6d

Browse files
committed
refactor: rename variables
1 parent 8d93e30 commit 8c7ee6d

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@GAP: 15px; // node horizontal gap
1+
@GAP: 15px; // child node horizontal gap
22

33
.mind-elixir {
44
position: relative;

src/linkDiv.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export default function linkDiv(primaryNode) {
7171
const alignRight = 10000 - root.offsetWidth / 2 - primaryNodeHorizontalGap
7272
const alignLeft = 10000 + root.offsetWidth / 2 + primaryNodeHorizontalGap
7373
for (let i = 0; i < primaryNodeList.length; i++) {
74+
let x1 = 10000
7475
let x2, y2
7576
const el = primaryNodeList[i]
7677
const elOffsetH = el.offsetHeight
@@ -81,15 +82,14 @@ export default function linkDiv(primaryNode) {
8182
y2 = base + currentOffsetL + elOffsetH / 2
8283

8384
// https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#path_commands
84-
let LEFT = 10000
8585
if (this.primaryLinkStyle === 2) {
8686
if (this.direction === SIDE) {
87-
LEFT = 10000 - root.offsetWidth / 6
87+
x1 = 10000 - root.offsetWidth / 6
8888
}
8989
if (y2 < 10000) {
90-
primaryPath += `M ${LEFT} 10000 V ${y2 + 20} C ${LEFT} ${y2} ${LEFT} ${y2} ${LEFT - 20} ${y2} H ${x2}`
90+
primaryPath += `M ${x1} 10000 V ${y2 + 20} C ${x1} ${y2} ${x1} ${y2} ${x1 - 20} ${y2} H ${x2}`
9191
} else {
92-
primaryPath += `M ${LEFT} 10000 V ${y2 - 20} C ${LEFT} ${y2} ${LEFT} ${y2} ${LEFT - 20} ${y2} H ${x2}`
92+
primaryPath += `M ${x1} 10000 V ${y2 - 20} C ${x1} ${y2} ${x1} ${y2} ${x1 - 20} ${y2} H ${x2}`
9393
}
9494
} else {
9595
primaryPath += `M 10000 10000 C 10000 10000 ${10000 + 2 * primaryNodeHorizontalGap * 0.03} ${y2} ${x2} ${y2}`
@@ -106,15 +106,14 @@ export default function linkDiv(primaryNode) {
106106
x2 = alignLeft + 15 // padding
107107
y2 = base + currentOffsetR + elOffsetH / 2
108108

109-
let LEFT = 10000
110109
if (this.primaryLinkStyle === 2) {
111110
if (this.direction === SIDE) {
112-
LEFT = 10000 + root.offsetWidth / 6
111+
x1 = 10000 + root.offsetWidth / 6
113112
}
114113
if (y2 < 10000) {
115-
primaryPath += `M ${LEFT} 10000 V ${y2 + 20} C ${LEFT} ${y2} ${LEFT} ${y2} ${LEFT + 20} ${y2} H ${x2}`
114+
primaryPath += `M ${x1} 10000 V ${y2 + 20} C ${x1} ${y2} ${x1} ${y2} ${x1 + 20} ${y2} H ${x2}`
116115
} else {
117-
primaryPath += `M ${LEFT} 10000 V ${y2 - 20} C ${LEFT} ${y2} ${LEFT} ${y2} ${LEFT + 20} ${y2} H ${x2}`
116+
primaryPath += `M ${x1} 10000 V ${y2 - 20} C ${x1} ${y2} ${x1} ${y2} ${x1 + 20} ${y2} H ${x2}`
118117
}
119118
} else {
120119
primaryPath += `M 10000 10000 C 10000 10000 ${10000 + 2 * primaryNodeHorizontalGap * 0.03} ${y2} ${x2} ${y2}`

0 commit comments

Comments
 (0)