huchenlei/sd-webui-openpose-editor

[Feature Request] Add Redo/Undo feature

huchenlei opened this issue · 1 comments

The redo/undo should cover most UI interactions that affects outputs:

  • Move keypoint (Merging multiple movement events into single one?)
  • Rotation
  • Scaling
  • Toggle visibility
  • Add object to canvas (object includes: background image, hand/face/body)
  • Remove object from canvas

The redo/undo should not cover:

  • Create active selection
  • Group/Ungroup
  • Lock/Unlock

Maybe we should also display a event ring to help users understand what would happen if undo is pressed.

Progress Update:
Here is how another openpose editor does for undo/redo feature. It captures the state of canvas at each undoable event (move for them), and directly set the canvas state back.
https://github.com/fkunn1326/openpose-editor/blob/722bca6fb9b062815d13b950e7040589abaec797/javascript/main.js#L91

This has some problems in here, not only because we have more operations to support, but also because we have a control panel that is not 100% determined by canvas state, i.e. if we remove all canvas objects and re-add objects with same data to the canvas, the link between canvas objects to the controlpanel objects will be broken.

It will not be simple to implement a redo/undo feature, but not impossible. I will be thinking more on a good design that fits here.