fix(stretch): free crossing-window corners from Ortho, draw filled marquee (#291)

STRETCH picks its crossing window as two corner points. After the first
corner set last_point, Ortho/Polar constrained the opposite corner to an axis
through it, collapsing the window to a line and making selection impossible.

Add CadCommand::window_corner_pick(); STRETCH returns true for its two window
steps, and the viewport skips the ortho/polar (and OTRACK) lock for that point
in both the preview and commit paths — the corners are now free.

Also render the window like a normal box selection instead of a bare green
outline: add SelectionState::preview_box (a hit-test-free marquee), draw it
with the shared draw_marquee helper (green crossing fill + stroke), and drive
it from the command's new window_first_corner(). Cleared on command end.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-10 13:32:32 +03:00
1 parent 824a508555
commit e015fbe328
6 files changed
+105 -50

No files matched your search

+6
View File
@@ -15,6 +15,12 @@ pub struct SelectionState {
pub box_last: Option<(Point, Point)>,
pub box_crossing: bool,
pub box_last_crossing: bool,
/// A preview-only selection marquee `(anchor, current, crossing)` in canvas
/// pixels, drawn identically to a real box-selection (green crossing fill /
/// blue window fill) but with NO hit-test behaviour. Commands that pick a
/// window by point (STRETCH's crossing window) set this so the region reads
/// like a normal selection instead of a bare outline. (#291)
pub preview_box: Option<(Point, Point, bool)>,
pub poly_active: bool,
pub poly_points: Vec<Point>,
pub poly_crossing: bool,
+3
View File
@@ -27,6 +27,9 @@ impl Scene {
self.preview_wires = vec![];
self.preview_text = vec![];
self.interim_wire = None;
// Drop any point-picked window marquee (STRETCH) so it doesn't linger
// after the command ends before the next mouse move. (#291)
self.selection.borrow_mut().preview_box = None;
}
pub fn wire_models_for(&self, handles: &[acadrust::Handle]) -> Vec<WireModel> {