Skip to content

Commit

Permalink
#3728 - Add group selection for macromolecules (#3924)
Browse files Browse the repository at this point in the history
  • Loading branch information
Balzamova authored Jan 18, 2024
1 parent 8e28981 commit 15d93cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class SelectRectangle implements BaseTool {
} else if (renderer instanceof BaseRenderer && event.shiftKey) {
const drawingEntity = renderer.drawingEntity;
modelChanges =
this.editor.drawingEntitiesManager.selectCurrentDrawingEntities(
this.editor.drawingEntitiesManager.addDrawingEntityToSelection(
drawingEntity,
);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,29 +175,15 @@ export class DrawingEntitiesManager {
return command;
}

private addOperationToCommand(
command: Command,
drawingEntity: DrawingEntity,
) {
const operation = new DrawingEntitySelectOperation(drawingEntity);
command.addOperation(operation);
}

public selectCurrentDrawingEntities(drawingEntity: DrawingEntity) {
public addDrawingEntityToSelection(drawingEntity: DrawingEntity) {
const command = new Command();

this.allEntities.forEach(([, drawingEntity]) => {
if (drawingEntity.selected) {
this.addOperationToCommand(command, drawingEntity);
}
});

if (drawingEntity.selected) {
drawingEntity.turnOffSelection();
} else {
drawingEntity.turnOnSelection();
}
this.addOperationToCommand(command, drawingEntity);
command.addOperation(new DrawingEntitySelectOperation(drawingEntity));

return command;
}
Expand Down

0 comments on commit 15d93cf

Please sign in to comment.