fix: restore arrow endpoint handles after reload/undo - #119
Open
Amark19 wants to merge 1 commit into
Open
Conversation
…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>
Deploying whiteboard with
|
| 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 |
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.
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
buildArrowGroupinstalls custom endpoint controls (plushasBorders:falseandperPixelTargetFind) on the group instance. Those aren't serialized, so anyloadFromJSON(IndexedDB restore and undo/redo) produces an arrow with fabric's default controls.Fix
ArrowEndpointHandler— onselection:created/updated, re-attach the endpoint controls (andperPixelTargetFind) to a selected top-level arrow. Mirrors the existingLineEndpointHandler, so it covers every load path, not just initial reload.Test plan
ml,mr,mt,mb,tl,tr,bl,br,mtr); after selecting it the controls were back toe1,e2withhasBorders:falseandperPixelTargetFind:true— the correct endpoint dots (screenshot).🤖 Generated with Claude Code