From 2c4a8619a8c452d474e76931eae830d9413b8ce8 Mon Sep 17 00:00:00 2001 From: Marc-Andre Ferland Date: Sat, 8 Oct 2022 08:42:25 -0400 Subject: [PATCH] Only 'resizeInpaintingEditor' if 'aspectRatio' has changed. --- ui/media/main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/media/main.js b/ui/media/main.js index 9e91cb8f..c33429c2 100644 --- a/ui/media/main.js +++ b/ui/media/main.js @@ -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'