Skip to content

Commit e560596

Browse files
authored
Preserve multiselection when shift held on right click (#117)
Fixes #112
1 parent f2e6ed7 commit e560596

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/multiselect_controls.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,18 @@ export class MultiselectControls {
392392
!(Blockly.getSelected() instanceof MultiselectDraggable)) {
393393
// Blockly.getSelected() is not a multiselectDraggable
394394
// and selected block is not in dragSelection
395-
for (const draggable of this.multiDraggable.subDraggables) {
396-
draggable[0].unselect();
395+
if (this.dragSelection.size > 1) {
396+
// Preserve multiselection when shift held on right click
397+
Blockly.common.setSelected(this.multiDraggable);
398+
} else {
399+
for (const draggable of this.multiDraggable.subDraggables) {
400+
draggable[0].unselect();
401+
}
402+
this.multiDraggable.clearAll_();
403+
this.dragSelection.clear();
404+
this.lastSelectedElement_ = Blockly.getSelected();
405+
inPasteShortcut.set(this.workspace_, false);
397406
}
398-
this.multiDraggable.clearAll_();
399-
this.dragSelection.clear();
400-
this.lastSelectedElement_ = Blockly.getSelected();
401-
inPasteShortcut.set(this.workspace_, false);
402407
}
403408
} else {
404409
// In multiselect mode

0 commit comments

Comments
 (0)