feat(plot): snap plot-window corners to geometry endpoints#293
Open
sLuCHaa wants to merge 1 commit into
Open
Conversation
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PLOTWINDOW/PWnow snaps to geometry while you pick the two corners of the plot window, so the plotted area lands exactly on a frame's corners.Previously the plot-window corners followed the raw cursor (the global object-snap master toggle is off by default, so nothing snapped), and it was hard to hit the frame corners precisely.
Behavior
While
PLOTWINDOWis picking either corner (model or paper space), Endpoint object-snap is forced on — independent of the global OSNAP toggle — with the normal snap marker, so the pick lands on frame corners. The snapper's master toggle and configured modes are saved before the pick and restored after, so the user's global OSNAP settings are unchanged. No other command is affected.Implementation
CadCommand::forces_endpoint_snap(&self) -> bool— new opt-in trait method (defaultfalse); onlyPlotWindowCommandreturnstrue.Snapper::snap_forced_corners(...)— same signature assnap(); replaces the active mode set with Endpoint only, runs the existingsnap(), then restoressnap_enabledand the mode set.snap_forced_cornerswhen the active command opts in, leaving every other command on the existingsnap()path.The rest of the snap pipeline (marker rendering, effective-point selection,
on_point) is unchanged.Tests
PlotWindowCommand::forces_endpoint_snap()returnstrue(opt-in).forced_corner_modes()is exactly{Endpoint}(no Intersection/Midpoint/Center).snap_forced_cornersrestoressnap_enabledand the mode set after the call.The live corner-snap-during-pick was verified manually (it depends on the camera projection, already covered by existing snap tests).
Scope
PLOTWINDOW/PWonly. No changes to global OSNAP defaults or any other snap caller.