Skip to content

fix(animation): re-run edge geometry after animate() so schema edges don't detach#44

Merged
zachiler merged 2 commits into
devfrom
fix/schema-edges-detach-on-animate
Jul 15, 2026
Merged

fix(animation): re-run edge geometry after animate() so schema edges don't detach#44
zachiler merged 2 commits into
devfrom
fix/schema-edges-detach-on-animate

Conversation

@zachiler

Copy link
Copy Markdown
Member

Bug

On any animate() (Scramble, reset-grid, layout animations), schema edges detached to the node centre and lost their avoidant routing and stayed that way. Worst on a move whose final positions equal the current ones (reset-grid on an already-gridded graph).

Root cause

animate() drives edges each frame through _refreshEdgePaths (canvas-dom.ts) — a simplified imperative path that uses getHandleCoords (node-side centre) and passes no obstacles, for per-frame speed. On completion nothing re-ran the reactive edge effect (which uses schema handle geometry + obstacle routing), so the simplified node-centre bezier persisted. Pre-existing; unrelated to the routing-quality workstreams (reproduces on dev with WS-2 absent).

Fix

animate() now runs the same settle canvas-history.ts uses after a restore — bump _layoutAnimTick (re-measure) + _commitNodeGeometry (rebuild the obstacle snapshot) once on completion (rAF). Applied to both the instant and animated completion paths.

Verification

  • Unit test (canvas-animation.test.ts): settle fires after a move (_layoutAnimTick bumped, _commitNodeGeometry called). Full suite 2869 green.
  • Real browser: reset-grid → 7/7 edges routed to schema handles (219,51 / MCCC), 0 node-centre; scramble → 0 node-centre fallbacks.

Owner reviews & merges — do not merge or tag.

zachiler added 2 commits July 14, 2026 22:27
…don't detach

animate()/scramble/reset-grid drive edges via _refreshEdgePaths (a simplified
node-centre, no-obstacle path for per-frame speed). Nothing re-ran the reactive
edge effect on settle, so schema edges stayed at the node centre with routing
lost — worst when final positions equal current (reset-grid on an already-gridded
graph: the reactive position write is a no-op). animate() now settles like the
history-restore path: bump _layoutAnimTick + _commitNodeGeometry on completion.
@zachiler
zachiler merged commit c1d8410 into dev Jul 15, 2026
@zachiler
zachiler deleted the fix/schema-edges-detach-on-animate branch July 15, 2026 03:02
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