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 <noreply@anthropic.com>
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

+19
View File
@@ -702,6 +702,25 @@ pub trait CadCommand: Send {
CmdResult::Cancel
}
/// Returns `true` when the current step picks a corner of a selection
/// *window* by point (e.g. STRETCH's crossing window). Such a pick must be a
/// free point: applying the Ortho/Polar lock would pin the opposite corner to
/// an axis through the first corner, collapsing the rectangle to a line and
/// making the window unusable. The host skips the ortho/polar constraint for
/// these steps. Default `false`. (#291)
fn window_corner_pick(&self) -> bool {
false
}
/// The already-picked first corner of the selection window (world space)
/// while `window_corner_pick()` is true and the opposite corner is being
/// dragged. The host projects it and draws a filled selection marquee to the
/// cursor, so a point-picked window (STRETCH) reads like a normal box
/// selection. `None` before the first corner is set. (#291)
fn window_first_corner(&self) -> Option<glam::DVec3> {
None
}
/// Returns `true` when the command wants object picks via Tangent snap.
fn needs_tangent_pick(&self) -> bool {
false