Keep dragged graph items in view #56

Merged
lost-rob0t merged 3 commits from fix/graph-drag-viewport into main 2026-07-26 01:23:56 +00:00
lost-rob0t commented 2026-07-26 01:22:33 +00:00 (Migrated from github.com)

Summary

Fixes graph items disappearing or jumping out of view while dragging and panning.

  • keeps the Cytoscape instance alive when persisted graph positions change
  • clamps a dropped node to the visible canvas bounds
  • corrects a completed pan/zoom when it would hide the selected node
  • adds focused viewport-boundary unit coverage

Root cause

The canvas lifecycle effect depended on callbacks whose identities changed after every persisted position update. Finishing a drag therefore destroyed and recreated Cytoscape. The rebuilt view could jump, and no viewport constraint kept the active item visible.

Validation

  • focused viewport helper tests added
  • equivalent local implementation: 45 unit tests, typecheck, service-worker checks, smoke test, and production build passed
  • GitHub Actions must pass before merge

Follow-up to #55.

## Summary Fixes graph items disappearing or jumping out of view while dragging and panning. - keeps the Cytoscape instance alive when persisted graph positions change - clamps a dropped node to the visible canvas bounds - corrects a completed pan/zoom when it would hide the selected node - adds focused viewport-boundary unit coverage ## Root cause The canvas lifecycle effect depended on callbacks whose identities changed after every persisted position update. Finishing a drag therefore destroyed and recreated Cytoscape. The rebuilt view could jump, and no viewport constraint kept the active item visible. ## Validation - focused viewport helper tests added - equivalent local implementation: 45 unit tests, typecheck, service-worker checks, smoke test, and production build passed - GitHub Actions must pass before merge Follow-up to #55.
Sign in to join this conversation.
No description provided.