Repository navigation
Snap scenery objects vertex-to-vertex and edge-to-edge - #123
Merged
Merged
Conversation
added 8 commits
November 12, 2026 15:19
…key and UI buttons)
turbo-devv
reviewed
Nov 14, 2026
turbo-devv
left a comment
Contributor
There was a problem hiding this comment.
Thanks, this is a useful feature, but a few things need to change before it can go in:
- It takes over V and L. The new
KeyCode::KeyV/KeyCode::KeyLbranches inApprun before the keymap, whenever the crossing editor is closed. In openMapper's own key set V isXformMoveand L isLines(src/controls.rs), so both stop working, even with nothing selected: you only get the "Select an object first" toast. The new modes need commands incontrols.rs(with free default keys, rebindable like the others), not hardcoded keys. - CONTRIBUTING: new code goes into new files. Around 1,200 lines go into
src/editor.rs, which should only get small hooks. Please move the snap state, picking, apply and overlay code into its own module (e.g.src/snap.rs) and keep only the calls ineditor.rs/app.rs/ui.rs. - Cost on every mouse move and frame.
vertex_at_ray/edge_at_rayrun on everyhover_ray. In target mode they go through every tile without a tile cull and rebuildobject_vertices_for_snap/object_edges_for_snap(newHashSets, up to 200,000 edges) for every object within 600 m. They also sample every spline on the map every 8 m with no distance check. The overlay pushes up to 200,000 edge lines and all deduplicated vertices of the selection every frame. Please cull tiles and splines by distance aslanes::near_skippingdoes, cache the selected objects' vertices/edges for the duration of the mode, and cap what goes into the overlay. - Bug in
edge_at_ray. Thecontinuein the centre-line occlusion check skips that segment's curb edges too. - The same hit/score block is repeated about eight times. One helper would make it shorter and easier to check.
The assets.rs key normalisation is fine on its own, but it is a separate change and would be better as a separate PR.
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
Shiftkey).Ctrl+P-> "Snap Vertex to Vertex", "Snap Edge to Edge").Test plan
northkcnewnew2.scowith >30k edges); confirm all edges render and are selectable without crashing or freezing.cargo test --bin openmapper snap; confirm all unit tests pass.