diff --git a/packages/x6-plugin-selection/src/selection.ts b/packages/x6-plugin-selection/src/selection.ts index 90dd609ee7c..ea7b53fe350 100644 --- a/packages/x6-plugin-selection/src/selection.ts +++ b/packages/x6-plugin-selection/src/selection.ts @@ -468,12 +468,12 @@ export class SelectionImpl extends View { } } else { const scale = this.graph.transform.getScale() - for (let i = 0, len = this.$boxes.length; i < len; i += 1) { - this.updateElementPosition( - this.$boxes[i], - dx * scale.sx, - dy * scale.sy, - ) + for ( + let i = 0, $boxes = this.$boxes, len = $boxes.length; + i < len; + i += 1 + ) { + this.updateElementPosition($boxes[i], dx * scale.sx, dy * scale.sy) } this.updateElementPosition( this.selectionContainer, @@ -848,10 +848,15 @@ export class SelectionImpl extends View { confirmUpdate() { if (this.boxCount) { this.hide() - for (let i = 0, len = this.$boxes.length; i < len; i += 1) { - const box = this.$boxes[i] + for ( + let i = 0, $boxes = this.$boxes, len = $boxes.length; + i < len; + i += 1 + ) { + const box = $boxes[i] const cellId = Dom.attr(box, 'data-cell-id') Dom.remove(box) + this.boxCount -= 1 const cell = this.collection.get(cellId) if (cell) { this.createSelectionBox(cell)