Fixes failed inpainting with float bounding box

This commit is contained in:
psychedelicious 2022-10-29 14:17:18 +11:00
parent accb1779cb
commit 4204740cb2
2 changed files with 6 additions and 6 deletions

View File

@ -64,11 +64,11 @@ const BoundingBoxSettings = () => {
} = useAppSelector(boundingBoxDimensionsSelector);
const handleChangeBoundingBoxWidth = (v: number) => {
dispatch(setBoundingBoxDimensions({ ...boundingBoxDimensions, width: v }));
dispatch(setBoundingBoxDimensions({ ...boundingBoxDimensions, width: Math.floor(v) }));
};
const handleChangeBoundingBoxHeight = (v: number) => {
dispatch(setBoundingBoxDimensions({ ...boundingBoxDimensions, height: v }));
dispatch(setBoundingBoxDimensions({ ...boundingBoxDimensions, height: Math.floor(v) }));
};
const handleShowBoundingBox = (e: ChangeEvent<HTMLInputElement>) =>
@ -86,7 +86,7 @@ const BoundingBoxSettings = () => {
dispatch(
setBoundingBoxDimensions({
...boundingBoxDimensions,
width: canvasDimensions.width,
width: Math.floor(canvasDimensions.width),
})
);
};
@ -95,7 +95,7 @@ const BoundingBoxSettings = () => {
dispatch(
setBoundingBoxDimensions({
...boundingBoxDimensions,
height: canvasDimensions.height,
height: Math.floor(canvasDimensions.height),
})
);
};

View File

@ -111,7 +111,7 @@ const InpaintingBoundingBoxPreview = () => {
const handleOnDragMove = useCallback(
(e: KonvaEventObject<DragEvent>) => {
dispatch(setBoundingBoxCoordinate({ x: e.target.x(), y: e.target.y() }));
dispatch(setBoundingBoxCoordinate({ x: Math.floor(e.target.x()), y: Math.floor(e.target.y()) }));
},
[dispatch]
);
@ -242,7 +242,7 @@ const InpaintingBoundingBoxPreview = () => {
if (
newBoundBox.width + newBoundBox.x > imageToInpaint.width * stageScale ||
newBoundBox.height + newBoundBox.y >
imageToInpaint.height * stageScale ||
imageToInpaint.height * stageScale ||
newBoundBox.x < 0 ||
newBoundBox.y < 0
) {