mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fixes failed inpainting with float bounding box
This commit is contained in:
parent
accb1779cb
commit
4204740cb2
@ -64,11 +64,11 @@ const BoundingBoxSettings = () => {
|
|||||||
} = useAppSelector(boundingBoxDimensionsSelector);
|
} = useAppSelector(boundingBoxDimensionsSelector);
|
||||||
|
|
||||||
const handleChangeBoundingBoxWidth = (v: number) => {
|
const handleChangeBoundingBoxWidth = (v: number) => {
|
||||||
dispatch(setBoundingBoxDimensions({ ...boundingBoxDimensions, width: v }));
|
dispatch(setBoundingBoxDimensions({ ...boundingBoxDimensions, width: Math.floor(v) }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChangeBoundingBoxHeight = (v: number) => {
|
const handleChangeBoundingBoxHeight = (v: number) => {
|
||||||
dispatch(setBoundingBoxDimensions({ ...boundingBoxDimensions, height: v }));
|
dispatch(setBoundingBoxDimensions({ ...boundingBoxDimensions, height: Math.floor(v) }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleShowBoundingBox = (e: ChangeEvent<HTMLInputElement>) =>
|
const handleShowBoundingBox = (e: ChangeEvent<HTMLInputElement>) =>
|
||||||
@ -86,7 +86,7 @@ const BoundingBoxSettings = () => {
|
|||||||
dispatch(
|
dispatch(
|
||||||
setBoundingBoxDimensions({
|
setBoundingBoxDimensions({
|
||||||
...boundingBoxDimensions,
|
...boundingBoxDimensions,
|
||||||
width: canvasDimensions.width,
|
width: Math.floor(canvasDimensions.width),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -95,7 +95,7 @@ const BoundingBoxSettings = () => {
|
|||||||
dispatch(
|
dispatch(
|
||||||
setBoundingBoxDimensions({
|
setBoundingBoxDimensions({
|
||||||
...boundingBoxDimensions,
|
...boundingBoxDimensions,
|
||||||
height: canvasDimensions.height,
|
height: Math.floor(canvasDimensions.height),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -111,7 +111,7 @@ const InpaintingBoundingBoxPreview = () => {
|
|||||||
|
|
||||||
const handleOnDragMove = useCallback(
|
const handleOnDragMove = useCallback(
|
||||||
(e: KonvaEventObject<DragEvent>) => {
|
(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]
|
[dispatch]
|
||||||
);
|
);
|
||||||
@ -242,7 +242,7 @@ const InpaintingBoundingBoxPreview = () => {
|
|||||||
if (
|
if (
|
||||||
newBoundBox.width + newBoundBox.x > imageToInpaint.width * stageScale ||
|
newBoundBox.width + newBoundBox.x > imageToInpaint.width * stageScale ||
|
||||||
newBoundBox.height + newBoundBox.y >
|
newBoundBox.height + newBoundBox.y >
|
||||||
imageToInpaint.height * stageScale ||
|
imageToInpaint.height * stageScale ||
|
||||||
newBoundBox.x < 0 ||
|
newBoundBox.x < 0 ||
|
||||||
newBoundBox.y < 0
|
newBoundBox.y < 0
|
||||||
) {
|
) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user