This repository has been archived by the owner on Dec 19, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
History Subsystem
Cory McIlroy edited this page Nov 4, 2015
·
7 revisions
A description of the history store and how to call actions that update it appropriately.
For each document, the history store maintains a list of known past and future history states. If the state was created within Design Space, the history store captures a snapshot of the Document
and DocumentExport
models at that point in time. When performing an undo/redo to a particular state, if the document is cached it will be loaded into the document store. Otherwise, in the case of history states created in standard photoshop, or after some failure which caused the history store to be flushed, updateDocument
is called to obtain a fresh model.
History states can be created by one of three basic patterns:
- PS initiates a change (such as a canvas move) in which case we get two events: the specific change event, and a
historyState
event - DS initiated "optimistic" change in which the action can, in parallel with calling photoshop, emit a single flux event which is handled by both the document store and the history store
- DS initiated "non optimistic" change in which the action calls photoshop, and then performs some "query" (eg, resetBounds) to update our model accordingly. In this case, a generic
newHistoryState
action should be called early to increment the history store, and the PS query should amend that history state when it is processed.