Only 'resizeInpaintingEditor' if 'aspectRatio' has changed.

This commit is contained in:
Marc-Andre Ferland 2022-10-08 08:42:25 -04:00
parent 68dd9a29e8
commit 2c4a8619a8

View File

@ -279,6 +279,11 @@ function resizeInpaintingEditor() {
widthValue = (widthValue / heightValue) * INPAINTING_EDITOR_SIZE
heightValue = INPAINTING_EDITOR_SIZE
}
if (inpaintingEditor.opts.aspectRatio === (widthValue / heightValue).toFixed(3)) {
// Same ratio, don't reset the canvas.
return
}
inpaintingEditor.opts.aspectRatio = (widthValue / heightValue).toFixed(3)
inpaintingEditorContainer.style.width = widthValue + 'px'
inpaintingEditorContainer.style.height = heightValue + 'px'