Initially I intended to implement undo as only the last "action". However, the question was, how to know what's an "action". What if someone accidentally double clicked the fill button, or drew a very long line and then a very short one and only the short one could be undone. Only the scenario where the user does a single canvas fill is easily recognizable. I even considered to only make the last fill undo-able. On top of that you can't undo everything, for example "canvas clear" isn't undo-able right now, as the drawing data is discarded irreversibly right now, as this was the most easy and least error-prone way to implement it.
So for now, people can undo all their last "actions", whereas an action is defined either by type of draw event ("line" / "fill") or time taken between events (>150ms).
I don't really know what the most user friendly solution would be here.
Initially I intended to implement undo as only the last "action". However, the question was, how to know what's an "action". What if someone accidentally double clicked the fill button, or drew a very long line and then a very short one and only the short one could be undone. Only the scenario where the user does a single canvas fill is easily recognizable. I even considered to only make the last fill undo-able. On top of that you can't undo everything, for example "canvas clear" isn't undo-able right now, as the drawing data is discarded irreversibly right now, as this was the most easy and least error-prone way to implement it.
So for now, people can undo all their last "actions", whereas an action is defined either by type of draw event ("line" / "fill") or time taken between events (>150ms).
I don't really know what the most user friendly solution would be here.