History & modal text editing - adobe-photoshop/spaces-design GitHub Wiki
Some brief notes of the process of creating and editing text layers with special consideration of the history system. A separate path is described for creating a text layer but then committing with no text, as well as creating a text layer that will replace the initial "placeholder" layer of a new document.
create text layer, but then abort
- clicking canvas
- event: createTextLayer
- addLayer PUSH HIST STATE
- ESC no text
- event deleteTextLayer
- removeLayer PUSH HIST STATE BUT THEN RESETS IT
normal path (works.. but I if we ever fix the abort-path, it could affect the WAY this works, in that history state should be added only after commit)
- clicking canvas
- event: createTextLayer
- addLayer PUSH HIST STATE
- type text then ESC
- event: historyState
- recognized as "current" and ignored
- event: make
- resetLayer AMEND HIST STATE
edit existing path (works almost great)
- click text layer with text tool
- update text, hit ESC
- event: historyState
- PUSH history state
- event: set
- resetLayer AMEND HISTORY STATE (except actually would be cooler to MARRY history instead of AMEND? this is a subtle difference, essentially works only if the pre is a rogue state?)
"First Layer Replace"
- normal (works same as above)
- w/ abort (hacky in a similar way - it UPDATES the document)