Don't modify undoables that already have futures

For instance, in the sequence Select, Move Selection, Deselect, go back to Move Selection, move it more,
previously the changes got merged into the existing Move Selection.
Now a second Move Selection is created branching off of the first.
main
Isaiah Odhner 2019-12-13 11:33:59 -05:00
parent ca4270789b
commit 0be6084d26
1 changed files with 7 additions and 1 deletions

View File

@ -1094,7 +1094,13 @@ function undoable({name, icon, use_loose_canvas_changes, soft}, callback){
$G.triggerHandler("session-update"); // autosave
}
function make_or_update_undoable(undoable_meta, undoable_action) {
if (undoable_meta.match ? undoable_meta.match(current_history_node) : (current_history_node.name === undoable_meta.name)) {
if (current_history_node.futures.length === 0 &&
(
undoable_meta.match ?
undoable_meta.match(current_history_node) :
(current_history_node.name === undoable_meta.name)
)
) {
undoable_action();
current_history_node.image_data = ctx.getImageData(0, 0, canvas.width, canvas.height);
current_history_node.selection_image_data = selection && selection.canvas.ctx.getImageData(0, 0, selection.canvas.width, selection.canvas.height);