Add boxSelectionRectangle (Rectangle) for current drag area
2. Mouse handling
mousePressed: If click on empty area (no shape), start box selection. Store origin point. Clear current selection unless Shift is held.
mouseDragged: If boxSelectActive, update rectangle from origin to current point. Repaint to show selection box.
mouseReleased: Calculate final box rectangle. Find all shapes whose bounds intersect with box. Add to selection (or replace if no Shift). Clear box selection state, repaint.
3. Visual feedback
Draw semi-transparent rectangle during drag in ShapesView
Use XOR mode or overlay for drawing
Box outline: dashed line, gray color
4. Selection behavior
Default: box replaces current selection
Shift+drag: box adds to current selection
Box entirely within shape = shape selected
Partial overlap: select shape (standard behavior)
5. Intersection check
Use shape.getBounds().intersects(boxRect)
Handle composite shapes (SCollection) - check children
Files to modify
ui/Controller.java - mouse handling
ui/ShapesView.java - draw box overlay in paintComponent
Edge cases
Drag on existing selection: allow move instead of box select
Very small drag (< 5px): treat as click, select shape under point
Empty box: clear selection
## Overview
Add drag-to-select functionality for selecting multiple shapes within a rectangle.
## Current State
- Click selects single shape (in Controller.mousePressed)
- Shift+click adds to selection
- Selection uses SelectionAttributes
## Implementation Plan
### 1. Controller changes
- Add state: boxSelectOrigin (Point), boxSelectActive (boolean)
- Add boxSelectionRectangle (Rectangle) for current drag area
### 2. Mouse handling
- mousePressed: If click on empty area (no shape), start box selection. Store origin point. Clear current selection unless Shift is held.
- mouseDragged: If boxSelectActive, update rectangle from origin to current point. Repaint to show selection box.
- mouseReleased: Calculate final box rectangle. Find all shapes whose bounds intersect with box. Add to selection (or replace if no Shift). Clear box selection state, repaint.
### 3. Visual feedback
- Draw semi-transparent rectangle during drag in ShapesView
- Use XOR mode or overlay for drawing
- Box outline: dashed line, gray color
### 4. Selection behavior
- Default: box replaces current selection
- Shift+drag: box adds to current selection
- Box entirely within shape = shape selected
- Partial overlap: select shape (standard behavior)
### 5. Intersection check
- Use shape.getBounds().intersects(boxRect)
- Handle composite shapes (SCollection) - check children
## Files to modify
- ui/Controller.java - mouse handling
- ui/ShapesView.java - draw box overlay in paintComponent
## Edge cases
- Drag on existing selection: allow move instead of box select
- Very small drag (< 5px): treat as click, select shape under point
- Empty box: clear selection
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Overview
Add drag-to-select functionality for selecting multiple shapes within a rectangle.
Current State
Implementation Plan
1. Controller changes
2. Mouse handling
3. Visual feedback
4. Selection behavior
5. Intersection check
Files to modify
Edge cases