@@ -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+
188184export 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;`
0 commit comments