Fix annotation bugs in preview players#2013
Open
NicoPennec wants to merge 8 commits into
Open
Conversation
The undo stacks, silent-mode flag and save buffers were stored on $options, shared by all instances of a given component — causing silent strokes loss and mixed history when multiple players co-exist (e.g. ProductionNewsFeed v-for). Also fixes the silentAnnnotation typo.
deleteObject/addObject push their own entries on doneActionStack (directly, or via fabric's 'object:added' event), so undo left phantom entries — especially on grouped selections where N items were pushed but only one popped. Snapshot the stack length before the call and restore it after, and drop the redundant addToDeletions.
Wrap annotatedPreview and changesToSave with markRaw, for consistency with the doneActionStack/undoneActionStack treatment.
onFullScreenChange recreates fabric.Object instances; resolve undo/redo targets by id from the live canvas so the stack keeps operating on the current objects.
Pass the canvas DOM elements via $refs instead of the id string to avoid collisions when several PreviewPlayer instances share the default id.
ActiveSelection children carry left/top relative to its center. discardActiveObject() before the loop restores absolute coords.
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.
Problem
Multiple bugs in the preview annotation undo/redo mechanics: state shared across instances, side-effect pushes polluting the stack, stale
fabric.Objectrefs after fullscreen exit, double additions payload, lost positions onActiveSelectiondelete.Solution
addObject/deleteObjectin undo/redomarkRawon annotation save payloadsfabric.Canvas(avoid id collisions)addToAdditionson 'remove' undodiscardActiveObjectbefore deleting anActiveSelection