Built-in Undo & Redo
Set HistoryEnabled and the canvas keeps its own undo stack, recording a step at each point a user would recognise as one - a drag finished, an edge connected, something deleted, pasted, resized, aligned or nudged - and binding Ctrl/Cmd+Z and Ctrl/Cmd+Shift+Z. Selecting and panning are not edits, so they are not steps.
Ctrl+Z back, Ctrl+Shift+Z forward.
Undo keeps the viewport where you left it - coming back from an edit
should not also throw away where you had scrolled to.
Editing after undoing ends the redo branch, as in every editor.