From e6ec7393c6a314cd85da08dac17932eb3d4752a7 Mon Sep 17 00:00:00 2001 From: patriceac <48073125+patriceac@users.noreply.github.com> Date: Wed, 22 Feb 2023 23:46:07 -0800 Subject: [PATCH] Fix the restoration of the inpainting toggle The Inpainting toggle doesn't get restored at the very first attempt. Repro steps: 1. Create a task with a source image and enable the inpainting toggle. 2. Copy the task to the clipboard 3. Refresh the page (F5) 4. Paste the task from the clipboard Expected result: The task gets restored and the toggle is ON. Actual result: The task is restored, but the toggle is OFF. To fix that, we have to restore the toggle's state after loading the source image. --- ui/media/js/dnd.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/media/js/dnd.js b/ui/media/js/dnd.js index 0b22c4c9..e3b8cc9f 100644 --- a/ui/media/js/dnd.js +++ b/ui/media/js/dnd.js @@ -357,6 +357,7 @@ function restoreTaskToUI(task, fieldsToSkip) { initImagePreview.addEventListener('load', function() { if (Boolean(task.reqBody.mask)) { imageInpainter.setImg(task.reqBody.mask) + maskSetting.checked = true } }, { once: true }) initImagePreview.src = task.reqBody.init_image