fix: Reset handler not adjusting correctly

This commit is contained in:
blessedcoolant 2023-07-09 23:24:15 +12:00
parent d01d5b6fa9
commit cafd97e5bc
2 changed files with 4 additions and 4 deletions

View File

@ -55,8 +55,8 @@ const ParamHeight = (props: ParamHeightProps) => {
const handleReset = useCallback(() => {
dispatch(setHeight(initial));
if (aspectRatio) dispatch(setWidth(roundToEight(height * aspectRatio)));
}, [dispatch, initial, height, aspectRatio]);
if (aspectRatio) dispatch(setWidth(roundToEight(initial * aspectRatio)));
}, [dispatch, initial, aspectRatio]);
return (
<IAISlider

View File

@ -52,8 +52,8 @@ const ParamWidth = (props: ParamWidthProps) => {
const handleReset = useCallback(() => {
dispatch(setWidth(initial));
if (aspectRatio) dispatch(setHeight(roundToEight(width / aspectRatio)));
}, [dispatch, initial, width, aspectRatio]);
if (aspectRatio) dispatch(setHeight(roundToEight(initial / aspectRatio)));
}, [dispatch, initial, aspectRatio]);
return (
<IAISlider