Before moving through pages (prev/next/goto), any auto-color blocks must be solidified first (because they usually only solidify in a mousedown event, not mouseup).
This may change the state of the book, so it is always calls AddLog. However, when there is no apparent change in the books, it may look like undo did nothing.
There are a few ways to approach this:
Check if solidifyBoard changed the board, and only call addLog if it did
Make HistoryState automatically refuse to add a new log entry if it is the same as the log it is using(the last entry in undoLog)
Also record the traversal of pages by setting the page number you were on, so that undoing is able to change the page displayState will be displaying.
A combination of 2 and 3 could be useful, so that it always "snaps" you to the latest page where you changed something in the book.
Before moving through pages (prev/next/goto), any auto-color blocks must be solidified first (because they usually only solidify in a mousedown event, not mouseup). This may change the state of the book, so it is always calls
AddLog
. However, when there is no apparent change in the books, it may look likeundo
did nothing.There are a few ways to approach this:
solidifyBoard
changed the board, and only calladdLog
if it didHistoryState
automatically refuse to add a new log entry if it is the same as the log it is using(the last entry inundoLog
)displayState
will be displaying.A combination of 2 and 3 could be useful, so that it always "snaps" you to the latest page where you changed something in the book.