Skip to content

Guideline / Konva way / best practice to implement undo / redo? #1232

Answered by lavrton
lanyusan asked this question in Q&A
Discussion options

You must be logged in to vote

Everything is already described here:

https://konvajs.org/docs/data_and_serialization/Best_Practices.html#What-is-the-best-way-to-save-load-full-stage-content-and-how-to-implement-undo-redo
And here (react specific, but the idea is the same for other solutions):
https://konvajs.org/docs/react/Undo-Redo.html#page-title

In short:
You should not connect Konva and undo/redo function. Konva is a rendering engine. You can use pure DOM, SVG or any other drawing framework to render shapes on the page. From my standpoint, undo/redo should be independent of rendering.

You can use Konva JSON serialization for that. But I don't recommend doing that. It may work from simple scenes. But when you have e…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lanyusan
Comment options

Answer selected by lanyusan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants