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.
This commit is contained in:
patriceac 2023-02-22 23:46:07 -08:00 committed by GitHub
parent f733b53c25
commit e6ec7393c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -357,6 +357,7 @@ function restoreTaskToUI(task, fieldsToSkip) {
initImagePreview.addEventListener('load', function() { initImagePreview.addEventListener('load', function() {
if (Boolean(task.reqBody.mask)) { if (Boolean(task.reqBody.mask)) {
imageInpainter.setImg(task.reqBody.mask) imageInpainter.setImg(task.reqBody.mask)
maskSetting.checked = true
} }
}, { once: true }) }, { once: true })
initImagePreview.src = task.reqBody.init_image initImagePreview.src = task.reqBody.init_image