Skip to content

Commit

Permalink
fix: plugin-selection unmatch after scale graph (#3907) (#3918)
Browse files Browse the repository at this point in the history
Co-authored-by: cluezhang <[email protected]>
  • Loading branch information
cyrilluce and cluezhang authored Sep 19, 2023
1 parent eac458c commit 678883f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions packages/x6-plugin-selection/src/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,12 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
}
} 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,
Expand Down Expand Up @@ -848,10 +848,15 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
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)
Expand Down

0 comments on commit 678883f

Please sign in to comment.