Skip to content

Commit 90324fc

Browse files
authored
fix: check labelNode existed before change postion (#3737)
1 parent 09c6f2a commit 90324fc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/x6/src/view/edge.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -917,15 +917,18 @@ export class EdgeView<
917917

918918
for (let i = 0, ii = labels.length; i < ii; i += 1) {
919919
const label = labels[i]
920+
const labelNode = this.labelCache[i]
921+
922+
if (!labelNode) {
923+
continue
924+
}
925+
920926
const labelPosition = this.normalizeLabelPosition(
921927
label.position as Edge.LabelPosition,
922928
)
923929
const pos = ObjectExt.merge({}, defaultPosition, labelPosition)
924930
const matrix = this.getLabelTransformationMatrix(pos)
925-
this.labelCache[i].setAttribute(
926-
'transform',
927-
Dom.matrixToTransformString(matrix),
928-
)
931+
labelNode.setAttribute('transform', Dom.matrixToTransformString(matrix))
929932
}
930933

931934
return this

0 commit comments

Comments
 (0)