Skip to content

Commit

Permalink
bug(Select): Fix multi drag no longer working
Browse files Browse the repository at this point in the history
  • Loading branch information
Kruptein authored Nov 8, 2024
1 parent f3d3ae9 commit f53270f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client/src/game/tools/variants/select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ class SelectTool extends Tool implements ISelectTool {
}
}
if (shape.contains(gp)) {
if (!this.currentSelection.includes(shape)) {
const shapeSelectionIndex = this.currentSelection.findIndex((s) => s.id === shape.id);
if (shapeSelectionIndex === -1) {
if (event && ctrlOrCmdPressed(event)) {
this.currentSelection.push(shape);
} else {
Expand All @@ -345,8 +346,10 @@ class SelectTool extends Tool implements ISelectTool {
} else {
if (event && ctrlOrCmdPressed(event)) {
this.currentSelection = this.currentSelection.filter((s) => s.id !== shape.id);
} else {
this.currentSelection = [shape];
} else if (shapeSelectionIndex !== 0) {
// Move it to the front of the selection, so that it becomes the new focus
this.currentSelection.splice(shapeSelectionIndex, 1);
this.currentSelection.unshift(shape);
}
}
// Drag case, a shape is selected
Expand Down

0 comments on commit f53270f

Please sign in to comment.