forked from 1b-agent/opencadstudio-upstream
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:
1 parent
824a508555
commit
e015fbe328
6 files changed
+105
-50
No files matched your search
+17
-26
@@ -430,36 +430,19 @@ impl canvas::Program<Message> for SelectionCanvas {
|
||||
}
|
||||
|
||||
|
||||
if let (Some(a), Some(b)) = (self.selection.box_anchor, self.selection.box_current) {
|
||||
let (fill, stroke) = if self.selection.box_crossing {
|
||||
// Draw a selection marquee (green crossing / blue window) as a filled,
|
||||
// stroked rectangle between two canvas points. Shared by the live
|
||||
// box-selection and the preview-only window marquee (#291).
|
||||
fn draw_marquee(frame: &mut canvas::Frame, a: Point, b: Point, crossing: bool) {
|
||||
let (fill, stroke) = if crossing {
|
||||
(
|
||||
Color {
|
||||
r: 0.20,
|
||||
g: 0.72,
|
||||
b: 0.44,
|
||||
a: 0.12,
|
||||
},
|
||||
Color {
|
||||
r: 0.20,
|
||||
g: 0.72,
|
||||
b: 0.44,
|
||||
a: 0.9,
|
||||
},
|
||||
Color { r: 0.20, g: 0.72, b: 0.44, a: 0.12 },
|
||||
Color { r: 0.20, g: 0.72, b: 0.44, a: 0.9 },
|
||||
)
|
||||
} else {
|
||||
(
|
||||
Color {
|
||||
r: 0.20,
|
||||
g: 0.44,
|
||||
b: 0.72,
|
||||
a: 0.12,
|
||||
},
|
||||
Color {
|
||||
r: 0.20,
|
||||
g: 0.44,
|
||||
b: 0.72,
|
||||
a: 0.9,
|
||||
},
|
||||
Color { r: 0.20, g: 0.44, b: 0.72, a: 0.12 },
|
||||
Color { r: 0.20, g: 0.44, b: 0.72, a: 0.9 },
|
||||
)
|
||||
};
|
||||
let x0 = a.x.min(b.x);
|
||||
@@ -478,6 +461,14 @@ impl canvas::Program<Message> for SelectionCanvas {
|
||||
);
|
||||
}
|
||||
|
||||
if let (Some(a), Some(b)) = (self.selection.box_anchor, self.selection.box_current) {
|
||||
draw_marquee(&mut frame, a, b, self.selection.box_crossing);
|
||||
}
|
||||
// Preview marquee for point-picked windows (STRETCH) — same look, no pick.
|
||||
if let Some((a, b, crossing)) = self.selection.preview_box {
|
||||
draw_marquee(&mut frame, a, b, crossing);
|
||||
}
|
||||
|
||||
if self.selection.poly_active && self.selection.poly_points.len() > 1 {
|
||||
let (fill, stroke) = if self.selection.poly_crossing {
|
||||
(
|
||||
|
||||
Reference in new issue
Block a user