Repository navigation
fix(edit): honor vertex snapping for Point and MultiPoint targets - #859
Conversation
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Target eligibility and engine coverage crates/engine/src/cmd/design.rs, crates/engine/tests/snapping_point_types.rs, docs/user-guide/editing.md |
Point and MultiPoint geometries are treated as vertex targets when vertex snapping is enabled. Engine tests cover target selection and related snapping rules. The guide documents vertex-only targets and exclusion of the entire source feature when dragging a Point or MultiPoint member. |
Map-view editing interactions crates/ui-egui/tests/snapping_point_types.rs |
Integration tests cover dragging and point creation with Point and MultiPoint targets, including previews, commits, cancellation, read-only mode, source-feature exclusion, undo, and redo. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Possibly related issues
- Help test RustGIS v0.4.0: new features and existing workflows #748 — The issue requests testing editing workflows, including vertex edits. This PR adds tests for vertex snapping during editing.
Possibly related PRs
- opengeos/RustGIS#818 — This PR changes the same snapping implementation and preserves whole-feature exclusion while changing Point and MultiPoint target eligibility.
Suggested reviewers: giswqs
Merge Risk: 
Minimal · up to 0f59c
-
The snapping changes have no established actionable merge-blocking risk.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 3 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit tests each vertex near,
A Point snaps when the switch is clear.
MultiPoint members join the queue,
Drag previews show the target true.
Undo hops back; redo hops through.
Comment @coderabbitai help to get the list of available commands.
|
|
||
| /// Point features and MultiPoint members are vertex targets only, never edges or line ends. | ||
| /// Points and line ends take priority over edges. Equal distances keep the original layer, | ||
| /// row and member order. |
There was a problem hiding this comment.
Nit: the new doc lines sit above the existing summary and split it. The rendered doc now starts with details and the summary [snap_at], leaving out one feature… ends up mid-paragraph. Also "Points and line ends take priority" reads ambiguously (it means vertices and ends). Put the summary first:
| /// row and member order. | |
| /// [`snap_at`], leaving out one feature (layer id, row): a vertex being dragged doesn't snap to | |
| /// the shape it is changing. | |
| /// | |
| /// Point features and MultiPoint members are vertex targets only, never edges or line ends. | |
| /// Vertices and line ends take priority over edges. Equal distances keep the original layer, | |
| /// row and member order. |
(Replace lines 1070–1074.)
Code reviewThe fix is small and correct. Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base c281e2a to PR head 7afe380).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
Code reviewI found no bugs, security issues or performance problems in this PR. I read the full diff and checked the change in What I checked
BugsNone found. SecurityNone. PerformanceNone. The change adds one more O(members) loop per Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base c281e2a to PR head 0f59c19).
|
Summary
Point targets currently snap even when the Vertex option is off, while MultiPoint members are never offered as snap targets. Make both representations obey the Vertex switch and offer each MultiPoint member in its existing order. Neither representation supplies line ends or implicit edges between members.
Preserve whole-feature exclusion for the source Point/MultiPoint, point/end-before-edge priority, strict distance ties, layer visibility/scale rules, tolerance and projection handling. This complements #818's line/polygon source-identity change without changing its behavior. No commands, parameters, dependencies, data model or project format changes.
Testing
Previously completed scoped validation, reused for submission:
The existing case is
tests::modify_tools_snapping_topology_relationships_and_elevation. The two minimal regressions failed on the unchanged baseline before the fix. Coverage includes master/type switches, empty and repeated members, nearest/tie ordering, mixed point/line/polygon priority, tolerance, eligibility, projected invalid members, read-only queries and whole-source exclusion. UI tests use real pointer events and inspect the painted snap ring, rotated dragging, single-step commit/undo/redo, cancellation, read-only behavior and creation preview/placement parity.Also completed on Windows: affected engine/UI libraries and integration targets passed Clippy with
-D warnings; the engine'swasm32-unknown-unknowntype check passed; two offscreen UI screenshots were inspected. Engine Rustdoc including private items built with eight pre-existing public-to-private link warnings, each matched to the baseline source; the added docs introduced none.Executable code and all tests are unchanged from the three-platform validated patch. The shared target rules are documented after
snap_at's summary, using "vertices and line ends" for the priority rule;snap_exceptretains its summary and links to that contract. Formatting and diff checks passed, and a temporary-index three-way application to current upstream was clean. No compilation or tests were rerun for submission or the Rustdoc-only follow-up. Full workspace CI, Linux x86_64 runtime and browser runtime are not claimed.Related issue
Follow-up to the vertex-edit workflow in #143 / #428; complements #818's source-node exclusion with consistent point-target type switches.
Summary by CodeRabbit
Bug Fixes
Documentation