mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): canvas infinite loop when setting bbox dims
When typing in a number into the w/h number inputs, if the number is less than the step, it appears the value of 0 is used. This is unexpected; it means Chakra isn't clamping the value correctly (or maybe our wrapper isn't clamping it). Add checks to never bail if the width or height value from the number input component is 0.
This commit is contained in:
parent
8ceb94497e
commit
1b617768cf
@ -16,6 +16,9 @@ export const ImageSizeCanvas = memo(() => {
|
||||
|
||||
const onChangeWidth = useCallback(
|
||||
(width: number) => {
|
||||
if (width === 0) {
|
||||
return;
|
||||
}
|
||||
dispatch(setBoundingBoxDimensions({ width }, optimalDimension));
|
||||
},
|
||||
[dispatch, optimalDimension]
|
||||
@ -23,6 +26,9 @@ export const ImageSizeCanvas = memo(() => {
|
||||
|
||||
const onChangeHeight = useCallback(
|
||||
(height: number) => {
|
||||
if (height === 0) {
|
||||
return;
|
||||
}
|
||||
dispatch(setBoundingBoxDimensions({ height }, optimalDimension));
|
||||
},
|
||||
[dispatch, optimalDimension]
|
||||
|
@ -18,6 +18,9 @@ export const ImageSizeLinear = memo(() => {
|
||||
|
||||
const onChangeWidth = useCallback(
|
||||
(width: number) => {
|
||||
if (width === 0) {
|
||||
return;
|
||||
}
|
||||
dispatch(widthChanged({ width }));
|
||||
},
|
||||
[dispatch]
|
||||
@ -25,6 +28,9 @@ export const ImageSizeLinear = memo(() => {
|
||||
|
||||
const onChangeHeight = useCallback(
|
||||
(height: number) => {
|
||||
if (height === 0) {
|
||||
return;
|
||||
}
|
||||
dispatch(heightChanged({ height }));
|
||||
},
|
||||
[dispatch]
|
||||
|
Loading…
Reference in New Issue
Block a user