feat(ui): add box selection feature

- Selection: add addAll() method for bulk shape addition
- Controller: box selection with mouse drag on empty space
- ShapeDraftman: drawSelectionBox() for rubber-band rendering
- ShapesView: currentSelectionBox field and setter
This commit is contained in:
2026-03-26 23:54:46 +01:00
parent 3a6f98455a
commit b0e3428696
4 changed files with 128 additions and 22 deletions

View File

@@ -13,6 +13,7 @@ public class ShapesView extends JPanel {
private final Controller controller;
private ShapeVisitor draftman;
private boolean resizeMode;
private Rectangle currentSelectionBox;
public ShapesView(SCollection model) {
this.model = model;
@@ -25,6 +26,7 @@ public class ShapesView extends JPanel {
this.draftman = new ShapeDraftman(g);
((ShapeDraftman) this.draftman).setResizeMode(resizeMode);
model.accept(draftman);
((ShapeDraftman) this.draftman).drawSelectionBox(currentSelectionBox);
}
public Controller getController() {
@@ -38,4 +40,8 @@ public class ShapesView extends JPanel {
public void setResizeMode(boolean resizeMode) {
this.resizeMode = resizeMode;
}
public void setCurrentSelectionBox(Rectangle box) {
this.currentSelectionBox = box;
}
}