Skip to content
pixi-silk
GitHub repository
Entry point

pixi-silk/history

History (undo and redo), recordSignals, recordGizmo, bindHistoryKeys.

import { History, bindHistoryKeys, recordGizmo, recordSignals } from 'pixi-silk/history';

Classes#

ClassDescription
HistoryThe default undo stack: steps in memory, transactions, merging and a depth limit.

Interfaces#

InterfaceDescription
CommandOne undoable change.
HistoryKeysOptionsOptions of bindHistoryKeys.
HistoryLikeWhat undoable widgets need from a history. Implement it to plug in your own store: record gets changes that are already applied, begin and end bracket a gesture such as a drag.
HistoryOptionsOptions of History.
HistoryStateThe signals of a History.
HistoryStepOne entry of the stack: a label and the commands it undoes together.
RecordableGizmoWhat recordGizmo needs from a gizmo, such as TransformGizmo.
RecordGizmoOptionsOptions of recordGizmo.
RecordSignalsOptionsOptions of recordSignals.
SignalRecorderWhat recordSignals returns.
TransformSnapshotPosition, rotation and scale, the way a transform gizmo reads them.
TransformTargetSomething with a position, rotation and scale, such as a Pixi Container.

Functions#

FunctionDescription
bindHistoryKeysBinds cmd or ctrl + Z to undo, and shift + cmd or ctrl + Z and ctrl + Y to redo. Keys typed into inputs, text areas and editable elements are left alone. Returns the unbind function.
recordGizmoRecords every drag of a transform gizmo as one undoable step. The gizmo knows nothing about history: this watches its dragging signal. Returns the function that stops recording.
recordSignalsRecords every change of signals into history, so undo works without writing commands. Changes made in the same synchronous run (one handler, one batch) become one step. Inside a transaction everything merges into the transaction’s step.