PhiaUiDesign.Canvas.History (phia_ui v0.1.17)

Copy Markdown View Source

Command-pattern undo/redo stack for scene operations.

Summary

Functions

Check if redo is available

Check if undo is available

Returns a specification to start this module under a supervisor.

Clear all history

Push a command onto the undo stack, clearing redo

Pop the last command from redo stack (returns nil if empty)

Pop the last command from undo stack (returns nil if empty)

Types

command()

@type command() ::
  {:insert, PhiaUiDesign.Canvas.Node.t()}
  | {:delete, PhiaUiDesign.Canvas.Node.t()}
  | {:update, String.t(), map(), map()}
  | {:move, String.t(), String.t() | nil, String.t() | nil, integer()}

Functions

can_redo?(agent)

Check if redo is available

can_undo?(agent)

Check if undo is available

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear(agent)

Clear all history

push(agent, command)

Push a command onto the undo stack, clearing redo

redo(agent)

Pop the last command from redo stack (returns nil if empty)

start_link(opts \\ [])

undo(agent)

Pop the last command from undo stack (returns nil if empty)