From 96840fec64e0b6b9e016df22d6e21a560b273cf9 Mon Sep 17 00:00:00 2001 From: Qing Date: Tue, 28 Mar 2023 22:12:20 +0800 Subject: [PATCH] fix esc resetZoom --- lama_cleaner/app/src/components/Editor/Editor.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lama_cleaner/app/src/components/Editor/Editor.tsx b/lama_cleaner/app/src/components/Editor/Editor.tsx index b01e151..59bff84 100644 --- a/lama_cleaner/app/src/components/Editor/Editor.tsx +++ b/lama_cleaner/app/src/components/Editor/Editor.tsx @@ -728,15 +728,15 @@ export default function Editor() { // Zoom reset const resetZoom = useCallback(() => { - if (!minScale || !original || !windowSize) { + if (!minScale || !windowSize) { return } const viewport = viewportRef.current if (!viewport) { return } - const offsetX = (windowSize.width - original.width * minScale) / 2 - const offsetY = (windowSize.height - original.height * minScale) / 2 + const offsetX = (windowSize.width - imageWidth * minScale) / 2 + const offsetY = (windowSize.height - imageHeight * minScale) / 2 viewport.setTransform(offsetX, offsetY, minScale, 200, 'easeOutQuad') viewport.state.scale = minScale @@ -745,8 +745,8 @@ export default function Editor() { }, [ viewportRef, windowSize, - original, - original.width, + imageHeight, + imageWidth, windowSize.height, minScale, ]) @@ -787,7 +787,7 @@ export default function Editor() { }, []) const handleEscPressed = () => { - if (isInpainting) { + if (isProcessing) { return }