Skip to content

Tab cycles through every object snap under the cursor, not one per mode (gaps U4) - #1408

Open
marcoarnulfo wants to merge 1 commit into
storytold:mainfrom
marcoarnulfo:feat/tabsnap
Open

marcoarnulfo wants to merge 1 commit into
storytold:mainfrom
marcoarnulfo:feat/tabsnap

Conversation

@marcoarnulfo

Copy link
Copy Markdown
Contributor

Tab now cycles through every object snap under the cursor, not just the closest one of each mode.

In AutoCAD, pressing Tab at a point prompt steps through all the snap points in the aperture: with two line ends a hair apart, Tab reaches both, and after the last one it comes back to the first. Until now snap_candidates offered the closest snap of each running mode, so the second endpoint (or a second intersection, a second midpoint) was out of reach. This adds snap::points_near, which returns every gathered snap point within the aperture (it reuses the same gather/intersection/PER-TAN pass osnap runs, by letting finish add to the candidate list instead of consuming it), and snap_candidates merges those with the per-mode hits, nearest first, without repeats. The UI side is unchanged: the cycle still starts from the snap the marker shows, wraps around, and starts over once the cursor leaves the aperture. Nearest and deferred TAN/PER stay one candidate each (they have no fixed points), and model geometry seen through a layout viewport still offers one snap per mode; happy to extend that to every point too if you want it in this PR.

Two things I noticed and left alone, both already there before this change: leaving the canvas over a palette and coming back doesn't reset the cycle (a one-line change in canvas.rs, which I kept out because of #1061), and the quick-click path from #815 recomputes the snap without override_cursor, so it ignores a candidate picked with Tab. Happy to follow up on either.

Validation:

  • tab_snap_cycling::tab_reaches_both_close_endpoints, tab_goes_from_the_nearest_out_and_back_to_the_first, a_click_places_the_candidate_tab_chose: fail on main (Tab stays on 10,0, the only candidate), pass here
  • tab_snap_cycling::moving_the_cursor_away_starts_the_cycle_over, snap_overrides::tab_cycling_offers_every_endpoint_in_the_aperture_nearest_first (main returns 1 candidate of 3)
  • cargo test -p cadcraft-engine --test snap_overrides, cargo test -p cadcraft-ui-egui --test tab_snap_cycling --test measure_distance_snapping --test context_menu
  • cargo clippy -p cadcraft-engine -p cadcraft-ui-egui --all-targets -- -D warnings, cargo fmt --all -- --check
  • (macOS, Apple silicon)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant