Drag-time clamp: can't drag a node closer than its edge-label minimum#54
Merged
Conversation
…inimum Follow-up to the border-attachment / min-edge-length work. The minEdge force governs the AUTO-layout, but a user could still drag two nodes on top of each other (the dragged node is pinned to the cursor, so the force can't move it). Now the node drag handler clamps the dragged node's target so it stays at least the edge-label minimum (edge._minLen) away from any connected neighbor that isn't moving with it (cluster-co-moving free neighbors keep their distance, so they're excluded). New pure, unit-tested helper clampToMinNeighbors() projects the target out of each neighbor's min-radius circle (a few passes resolve multiple neighbors). Verified end-to-end (geometry diagnostic): dragging one node right onto a connected anchor stops at centerDist=306 = minLen=306 — the "IS PART OF" label still displays between them. web units 118 (5 new clamp tests), THE GATE 5/5, perf budgets 3/3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🧪 Comprehensive Test Suite
Full-stack smoke gate runs in the CI workflow. |
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.
Follow-up to #53. The
minEdgeforce governs the auto-layout, but a user could still drag two connected nodes on top of each other (the dragged node is pinned to the cursor, so the force can't move it). Now dragging is clamped too.Change
The node drag handler clamps the dragged node's target so it stays ≥ the edge-label minimum (
edge._minLen) from any connected neighbor that isn't moving with it (cluster-co-moving free neighbors keep their distance and are excluded). New pure, unit-testedclampToMinNeighbors()projects the target out of each neighbor's min-radius circle (a few passes resolve multiple neighbors).Verified (geometry diagnostic, live)
Dragging one node right onto a connected anchor stops at
centerDist = 306 = minLen = 306— the "IS PART OF" label still displays between them (screenshot intest-artifacts/geometry/drag-clamp.png).clampToMinNeighborstests)This completes the "nodes can't push closer than the label width" requirement for both layout and direct manipulation. (Remaining geometry follow-ups: rounded-corner border points, multi-edge/edge-bundling — task #22/#30.)
🤖 Generated with Claude Code