mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fixes bbox not resizing in outpainting if partially off screen
This commit is contained in:
parent
d7884432c9
commit
1bc1085542
@ -109,8 +109,8 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
|
|||||||
if (activeTabName === 'inpainting' || !shouldSnapToGrid) {
|
if (activeTabName === 'inpainting' || !shouldSnapToGrid) {
|
||||||
dispatch(
|
dispatch(
|
||||||
setBoundingBoxCoordinates({
|
setBoundingBoxCoordinates({
|
||||||
x: e.target.x(),
|
x: Math.floor(e.target.x()),
|
||||||
y: e.target.y(),
|
y: Math.floor(e.target.y()),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@ -238,7 +238,7 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
|
|||||||
|
|
||||||
// We may not change anything, stash the old position
|
// We may not change anything, stash the old position
|
||||||
let newCoordinate = { ...oldPos };
|
let newCoordinate = { ...oldPos };
|
||||||
console.log(oldPos, newPos);
|
|
||||||
// Set the new coords based on what snapped
|
// Set the new coords based on what snapped
|
||||||
if (didSnapX && !didSnapY) {
|
if (didSnapX && !didSnapY) {
|
||||||
newCoordinate = {
|
newCoordinate = {
|
||||||
@ -269,25 +269,21 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
|
|||||||
* Unlike anchorDragBoundFunc, it does get a width and height, so
|
* Unlike anchorDragBoundFunc, it does get a width and height, so
|
||||||
* the logic to constrain the size of the bounding box is very simple.
|
* the logic to constrain the size of the bounding box is very simple.
|
||||||
*/
|
*/
|
||||||
if (!baseCanvasImage && activeTabName !== 'outpainting')
|
|
||||||
return oldBoundBox;
|
// On the Inpainting canvas, the bounding box needs to stay in the stage
|
||||||
if (
|
if (
|
||||||
newBoundBox.width + newBoundBox.x > stageDimensions.width ||
|
activeTabName === 'inpainting' &&
|
||||||
newBoundBox.height + newBoundBox.y > stageDimensions.height ||
|
(newBoundBox.width + newBoundBox.x > stageDimensions.width ||
|
||||||
newBoundBox.x < 0 ||
|
newBoundBox.height + newBoundBox.y > stageDimensions.height ||
|
||||||
newBoundBox.y < 0
|
newBoundBox.x < 0 ||
|
||||||
|
newBoundBox.y < 0)
|
||||||
) {
|
) {
|
||||||
return oldBoundBox;
|
return oldBoundBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
return newBoundBox;
|
return newBoundBox;
|
||||||
},
|
},
|
||||||
[
|
[activeTabName, stageDimensions.height, stageDimensions.width]
|
||||||
activeTabName,
|
|
||||||
baseCanvasImage,
|
|
||||||
stageDimensions.height,
|
|
||||||
stageDimensions.width,
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleStartedTransforming = () => {
|
const handleStartedTransforming = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user