Mini Program canvas how to write the undo function (return to the previous step to draw)

clipboard.png

clipboard.png

as shown in the two pictures above, how did Mini Program canvas undo the first drawing, and then draw it again (the sixth pattern of the second picture becomes normal, and the fourth one becomes selected)


gives you an idea: the undo function can be implemented using stack data structures. What kind of data is stored in this data structure? you should consider it according to your program.

Menu