Skip to content

fix: restore arrow endpoint handles after reload/undo - #119

Open
Amark19 wants to merge 1 commit into
masterfrom
fix/restore-arrow-controls
Open

fix: restore arrow endpoint handles after reload/undo#119
Amark19 wants to merge 1 commit into
masterfrom
fix/restore-arrow-controls

Conversation

@Amark19

@Amark19 Amark19 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

The bug

After an arrow is drawn, reopening the tab (restore from IndexedDB) — or an undo/redo — showed the arrow with default bbox handles in the wrong positions instead of its two endpoint dots.

Root cause

buildArrowGroup installs custom endpoint controls (plus hasBorders:false and perPixelTargetFind) on the group instance. Those aren't serialized, so any loadFromJSON (IndexedDB restore and undo/redo) produces an arrow with fabric's default controls.

Fix

ArrowEndpointHandler — on selection:created/updated, re-attach the endpoint controls (and perPixelTargetFind) to a selected top-level arrow. Mirrors the existing LineEndpointHandler, so it covers every load path, not just initial reload.

Test plan

  • 89 tests pass; lint + prettier clean.
  • Verified in-browser: drew a bound arrow → waited for the debounced save → reloaded. Right after restore the arrow carried default handles (ml,mr,mt,mb,tl,tr,bl,br,mtr); after selecting it the controls were back to e1,e2 with hasBorders:false and perPixelTargetFind:true — the correct endpoint dots (screenshot).

🤖 Generated with Claude Code

…ols)

An arrow's custom endpoint controls (+ hasBorders:false, perPixelTargetFind)
are installed in buildArrowGroup but aren't serialized — so an arrow restored
from IndexedDB, or rebuilt by an undo/redo loadFromJSON, fell back to default
bbox handles in the wrong spots. Add ArrowEndpointHandler: on selection, re-attach
the endpoint controls to a selected arrow (mirrors LineEndpointHandler), which
covers every load path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying whiteboard with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3422b1c
Status: ✅  Deploy successful!
Preview URL: https://83b25a24.whiteboard-988.pages.dev
Branch Preview URL: https://fix-restore-arrow-controls.whiteboard-988.pages.dev

View logs

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