Skip to content

Drag-time clamp: can't drag a node closer than its edge-label minimum#54

Merged
mvalancy merged 1 commit into
developfrom
fix/edge-drag-clamp
Jun 14, 2026
Merged

Drag-time clamp: can't drag a node closer than its edge-label minimum#54
mvalancy merged 1 commit into
developfrom
fix/edge-drag-clamp

Conversation

@mvalancy

Copy link
Copy Markdown
Member

Follow-up to #53. The minEdge force 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-tested clampToMinNeighbors() 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 in test-artifacts/geometry/drag-clamp.png).

  • web units 118 (5 new clampToMinNeighbors tests)
  • THE GATE 5/5 (grow drag unaffected)
  • perf budgets 3/3 (drag-only change, not in the tick hot path)

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

…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>
@github-actions

Copy link
Copy Markdown

🧪 Comprehensive Test Suite

  • Unit suites (Node 18.x & 20.x) — core, web, server, mcp-server: ✅ passed
  • Installer & deploy config: ✅ passed

Full-stack smoke gate runs in the CI workflow.

@mvalancy mvalancy merged commit 22800a1 into develop Jun 14, 2026
16 checks passed
@mvalancy mvalancy deleted the fix/edge-drag-clamp branch June 14, 2026 05:55
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