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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user