From 2f1c431f3f420387a3e587103006e572f47e04f6 Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Sun, 15 Dec 2019 23:06:11 -0500 Subject: [PATCH] Fix enlarging for paste Fix warning dialog "History node switched during undoable callback for Paste: Enlarge. This shouldn't happen." Don't do an undoable inside an undoable. --- src/functions.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/functions.js b/src/functions.js index fc3239e..e934bbb 100644 --- a/src/functions.js +++ b/src/functions.js @@ -820,9 +820,10 @@ function paste(img){ ctx.fillRect(0, 0, canvas.width, canvas.height); } ctx.putImageData(original, 0, 0); - do_the_paste(); - $canvas_area.trigger("resize"); }); + // (undoable callback is synchronous, so this runs after it) + do_the_paste(); + $canvas_area.trigger("resize"); })[0].focus(); $w.$Button("Crop", () => { $w.close();