TargetedHistory<TKey, TPixel>¶
Namespace Nfty.Core.Editing in assembly Nfty.Core.
One undo/redo history across many surfaces: each step remembers WHICH surface it edited, so undoing restores that surface and says which one it was.
Type parameters
TKey- Identifies a surface.TPixel- The pixel the surfaces store.
Remarks¶
The same contract as EditHistory<TPixel> (a no-op edit is not recorded, a new edit clears redo), keyed. The caller resolves a key to its surface at undo time, so surfaces may be created lazily and outlive whatever the page is currently showing.
Constructors¶
TargetedHistory()¶
Properties¶
CanRedo¶
Whether an undone step is available to reapply.
CanUndo¶
Whether there is an applied step to undo.
PeekRedo¶
The surface the next redo would touch, or default when there is none.
PeekUndo¶
The surface the next undo would touch, or default when there is none.
Methods¶
Clear()¶
Forgets every step.
Do(TKey, IEditCommand<TPixel>, IEditSurface<TPixel>)¶
Applies a command to a surface and records it. A no-op edit is not recorded.
Parameters
key(TKey) - The surface's key.cmd(IEditCommand<TPixel>) - The edit.surface(IEditSurface<TPixel>) - The surface to edit.
Returns. True when the edit changed something and was recorded.
Redo(Func<TKey, IEditSurface<TPixel>>, TKey)¶
Reapplies the most recently undone step on the surface it touched.
Parameters
surfaceOf(Func<TKey, IEditSurface<TPixel>>) - Resolves a key to its surface.key(TKey) - The surface that was edited.
Returns. False when there was nothing to redo.
Undo(Func<TKey, IEditSurface<TPixel>>, TKey)¶
Undoes the most recent step on the surface it touched.
Parameters
surfaceOf(Func<TKey, IEditSurface<TPixel>>) - Resolves a key to its surface.key(TKey) - The surface that was restored.
Returns. False when there was nothing to undo.