fix esc resetZoom
This commit is contained in:
parent
e734859128
commit
96840fec64
@ -728,15 +728,15 @@ export default function Editor() {
|
|||||||
|
|
||||||
// Zoom reset
|
// Zoom reset
|
||||||
const resetZoom = useCallback(() => {
|
const resetZoom = useCallback(() => {
|
||||||
if (!minScale || !original || !windowSize) {
|
if (!minScale || !windowSize) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const viewport = viewportRef.current
|
const viewport = viewportRef.current
|
||||||
if (!viewport) {
|
if (!viewport) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const offsetX = (windowSize.width - original.width * minScale) / 2
|
const offsetX = (windowSize.width - imageWidth * minScale) / 2
|
||||||
const offsetY = (windowSize.height - original.height * minScale) / 2
|
const offsetY = (windowSize.height - imageHeight * minScale) / 2
|
||||||
viewport.setTransform(offsetX, offsetY, minScale, 200, 'easeOutQuad')
|
viewport.setTransform(offsetX, offsetY, minScale, 200, 'easeOutQuad')
|
||||||
viewport.state.scale = minScale
|
viewport.state.scale = minScale
|
||||||
|
|
||||||
@ -745,8 +745,8 @@ export default function Editor() {
|
|||||||
}, [
|
}, [
|
||||||
viewportRef,
|
viewportRef,
|
||||||
windowSize,
|
windowSize,
|
||||||
original,
|
imageHeight,
|
||||||
original.width,
|
imageWidth,
|
||||||
windowSize.height,
|
windowSize.height,
|
||||||
minScale,
|
minScale,
|
||||||
])
|
])
|
||||||
@ -787,7 +787,7 @@ export default function Editor() {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const handleEscPressed = () => {
|
const handleEscPressed = () => {
|
||||||
if (isInpainting) {
|
if (isProcessing) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user