Skip to content

Commit 016cd1d

Browse files
committed
chore: test link data render
1 parent 7dec733 commit 016cd1d

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

src/customLink.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,14 @@ export const createLink = function (this: MindElixirInstance, from: Topic, to: T
118118
h: pto.height,
119119
}
120120

121-
const p1 = calcP(fromData, p2x, p2y)
122-
const p1x = p1.x
123-
const p1y = p1.y
124-
125-
const p4 = calcP(toData, p3x, p3y)
126-
const p4x = p4.x
127-
const p4y = p4.y
121+
const { x: p1x, y: p1y } = calcP(fromData, p2x, p2y)
122+
const { x: p4x, y: p4y } = calcP(toData, p3x, p3y)
128123

129124
const arrowPoint = getArrowPoints(p3x, p3y, p4x, p4y)
130125

131126
const newLinkObj = {
132127
id: '',
133-
label: 'custom link',
128+
label: obj?.label || 'custom link',
134129
from: from.nodeObj.id,
135130
to: to.nodeObj.id,
136131
delta1: {
@@ -185,6 +180,7 @@ export const removeLink = function (this: MindElixirInstance, linkSvg?: CustomSv
185180
link.remove()
186181
link = null
187182
}
183+
188184
export const selectLink = function (this: MindElixirInstance, link: CustomSvg) {
189185
this.currentLink = link
190186
const obj = link.linkObj
@@ -239,13 +235,8 @@ export const showLinkController = function (
239235
this.P2.style.display = 'initial'
240236
this.P3.style.display = 'initial'
241237

242-
const p1 = calcP(fromData, p2x, p2y)
243-
let p1x = p1.x
244-
let p1y = p1.y
245-
246-
const p4 = calcP(toData, p3x, p3y)
247-
let p4x = p4.x
248-
let p4y = p4.y
238+
let { x: p1x, y: p1y } = calcP(fromData, p2x, p2y)
239+
let { x: p4x, y: p4y } = calcP(toData, p3x, p3y)
249240

250241
this.P2.style.cssText = `top:${p2y}px;left:${p2x}px;`
251242
this.P3.style.cssText = `top:${p3y}px;left:${p3x}px;`

src/exampleData/1.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,22 @@ const aboutMindElixir: MindElixirData = {
235235
],
236236
expanded: true,
237237
},
238-
linkData: {},
238+
linkData: {
239+
ac5fb1df7345e9c4: {
240+
id: 'ac5fb1df7345e9c4',
241+
label: 'Render',
242+
from: 'beeb784cc189375f',
243+
to: 'beeb7a6bec2d68f5',
244+
delta1: {
245+
x: 142.8828125,
246+
y: -57,
247+
},
248+
delta2: {
249+
x: 146.1171875,
250+
y: 45,
251+
},
252+
},
253+
},
239254
summaries: [
240255
{
241256
id: 'a5e68e6a2ce1b648',

src/summary.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ export const editSummary = function (this: MindElixirInstance, el: SummarySvgGro
215215
console.time('editSummary')
216216
if (!el) return
217217
const textEl = el.childNodes[1] as SVGTextElement
218+
console.log(textEl)
218219
const div = document.createElement('div')
219220
this.nodes.appendChild(div)
220221
const origin = textEl.innerHTML

0 commit comments

Comments
 (0)