forked from 1b-agent/opencadstudio-upstream
feat(plot): snap plot-window corners to geometry endpoints
PLOTWINDOW / PW now forces Endpoint object-snap while picking its two corners, independent of the global OSNAP toggle, so the plot area lands exactly on frame corners. The snapper's master toggle and configured modes are saved and restored around the pick, so the user's OSNAP settings are unchanged afterward. - CadCommand::forces_endpoint_snap() opt-in (default false; PlotWindowCommand true). - Snapper::snap_forced_corners() forces Endpoint only, then restores state. Intersection is deliberately excluded: it is O(n^2) over the hit-test wire set and froze the UI on large drawings when a plot window is picked zoomed-out. Frame corners are endpoints, so Endpoint alone suffices. - the cursor-move handler routes the plot-window pick through the forced path. Works in model and paper space (shared pick path). Tests: opt-in flag; forced mode set is endpoint-only; snapper state is restored after the call.
This commit is contained in:
1 parent
b50921923f
commit
6cd422e5b9
4 files changed
+121
-2
No files matched your search
@@ -889,8 +889,19 @@ pub(super) fn on_tick(&mut self, t: Instant) -> Task<Message> {
|
||||
} else {
|
||||
let (go, gr) = self.tabs[i].ucs_grid_basis();
|
||||
self.snapper.from_point = self.last_point;
|
||||
self.snapper
|
||||
.snap(snap_cursor, p, &all_wires[..], view_rot, eye, bounds, go, gr)
|
||||
let force_corners = self.tabs[i]
|
||||
.active_cmd
|
||||
.as_ref()
|
||||
.map(|c| c.forces_endpoint_snap())
|
||||
.unwrap_or(false);
|
||||
if force_corners {
|
||||
self.snapper.snap_forced_corners(
|
||||
snap_cursor, p, &all_wires[..], view_rot, eye, bounds, go, gr,
|
||||
)
|
||||
} else {
|
||||
self.snapper
|
||||
.snap(snap_cursor, p, &all_wires[..], view_rot, eye, bounds, go, gr)
|
||||
}
|
||||
};
|
||||
|
||||
// Object Snap Tracking: update dwell, then align the cursor
|
||||
|
||||
Reference in new issue
Block a user