Skip to content

Commit 8f83ac0

Browse files
committed
fix: fix wrong centric point
1 parent 3434b27 commit 8f83ac0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/linkDiv.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ import type { MindElixirInstance } from './types/index'
1717
const linkDiv = function (this: MindElixirInstance, mainNode?: Wrapper) {
1818
console.time('linkDiv')
1919

20-
// pin center
21-
this.nodes.style.top = `${10000 - this.nodes.offsetHeight / 2}px`
22-
this.nodes.style.left = `${10000 - this.nodes.offsetWidth / 2}px`
23-
24-
const mainNodeList = this.map.querySelectorAll('me-main > me-wrapper')
25-
this.lines.innerHTML = ''
26-
2720
const root = this.map.querySelector('me-root') as HTMLElement
2821
const pT = root.offsetTop
2922
const pL = root.offsetLeft
3023
const pW = root.offsetWidth
3124
const pH = root.offsetHeight
3225

26+
// pin center
27+
this.nodes.style.top = `${10000 - this.nodes.offsetHeight / 2}px`
28+
this.nodes.style.left = `${10000 - pL - pW / 2}px`
29+
30+
const mainNodeList = this.map.querySelectorAll('me-main > me-wrapper')
31+
this.lines.innerHTML = ''
32+
3333
for (let i = 0; i < mainNodeList.length; i++) {
3434
const el = mainNodeList[i] as Wrapper
3535
const tpc = el.querySelector<Topic>('me-tpc') as Topic

0 commit comments

Comments
 (0)