diff --git a/src/components/dialogs/OpenImage.tsx b/src/components/dialogs/OpenImage.tsx index e4c60df..9753eb1 100644 --- a/src/components/dialogs/OpenImage.tsx +++ b/src/components/dialogs/OpenImage.tsx @@ -37,17 +37,11 @@ function OpenImage({ close }: DialogProps) { } }, [acceptedFiles]); - const onDimensionChange = (e: React.ChangeEvent, isWidth: boolean) => { + const onDimensionChange = (e: React.ChangeEvent) => { const newDimension = Number(e.target.value); if (newDimension < 1 || newDimension > 10000) return; - setImageDimensions(() => { - if (isWidth) { - return { width: newDimension, height: Math.round(newDimension / aspectRatio) }; - } else { - return { width: Math.round(newDimension / aspectRatio), height: newDimension }; - } - }); + setImageDimensions(() => ({ width: newDimension, height: Math.round(newDimension / aspectRatio) })); }; const onSubmit = () => { @@ -99,18 +93,12 @@ function OpenImage({ close }: DialogProps) {
- onDimensionChange(e, true)} /> + onDimensionChange(e)} />
- onDimensionChange(e, false)} - /> + onDimensionChange(e)} />