Skip to content

Commit

Permalink
fix: check labelNode existed before change postion
Browse files Browse the repository at this point in the history
  • Loading branch information
NewByVector committed Jul 5, 2023
1 parent dfa00c8 commit 5022afe
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/x6/src/view/edge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -917,15 +917,18 @@ export class EdgeView<

for (let i = 0, ii = labels.length; i < ii; i += 1) {
const label = labels[i]
const labelNode = this.labelCache[i]

if (!labelNode) {
continue
}

const labelPosition = this.normalizeLabelPosition(
label.position as Edge.LabelPosition,
)
const pos = ObjectExt.merge({}, defaultPosition, labelPosition)
const matrix = this.getLabelTransformationMatrix(pos)
this.labelCache[i].setAttribute(
'transform',
Dom.matrixToTransformString(matrix),
)
labelNode.setAttribute('transform', Dom.matrixToTransformString(matrix))
}

return this
Expand Down

0 comments on commit 5022afe

Please sign in to comment.