mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Outpainting tab loads to empty canvas instead of upload
This commit is contained in:
parent
70dcfa1684
commit
17b295871f
File diff suppressed because one or more lines are too long
4
frontend/dist/index.html
vendored
4
frontend/dist/index.html
vendored
@ -9,6 +9,7 @@
|
|||||||
<<<<<<< refs/remotes/upstream/development
|
<<<<<<< refs/remotes/upstream/development
|
||||||
<<<<<<< refs/remotes/upstream/development
|
<<<<<<< refs/remotes/upstream/development
|
||||||
<<<<<<< refs/remotes/upstream/development
|
<<<<<<< refs/remotes/upstream/development
|
||||||
|
<<<<<<< refs/remotes/upstream/development
|
||||||
<<<<<<< refs/remotes/upstream/development
|
<<<<<<< refs/remotes/upstream/development
|
||||||
<script type="module" crossorigin src="./assets/index.a8ba2a6c.js"></script>
|
<script type="module" crossorigin src="./assets/index.a8ba2a6c.js"></script>
|
||||||
<link rel="stylesheet" href="./assets/index.40a72c80.css">
|
<link rel="stylesheet" href="./assets/index.40a72c80.css">
|
||||||
@ -24,6 +25,9 @@
|
|||||||
>>>>>>> Builds fresh bundle
|
>>>>>>> Builds fresh bundle
|
||||||
=======
|
=======
|
||||||
<script type="module" crossorigin src="./assets/index.205e5ea1.js"></script>
|
<script type="module" crossorigin src="./assets/index.205e5ea1.js"></script>
|
||||||
|
=======
|
||||||
|
<script type="module" crossorigin src="./assets/index.7f5e02f1.js"></script>
|
||||||
|
>>>>>>> Outpainting tab loads to empty canvas instead of upload
|
||||||
<link rel="stylesheet" href="./assets/index.978b75a1.css">
|
<link rel="stylesheet" href="./assets/index.978b75a1.css">
|
||||||
>>>>>>> Builds fresh bundle
|
>>>>>>> Builds fresh bundle
|
||||||
</head>
|
</head>
|
||||||
|
@ -54,7 +54,7 @@ const makeSocketIOEmitters = (
|
|||||||
systemState,
|
systemState,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (['inpainting', 'outpainting'].includes(generationMode)) {
|
if (generationMode === 'inpainting') {
|
||||||
const baseCanvasImage = baseCanvasImageSelector(getState());
|
const baseCanvasImage = baseCanvasImageSelector(getState());
|
||||||
const imageUrl = baseCanvasImage?.image.url;
|
const imageUrl = baseCanvasImage?.image.url;
|
||||||
|
|
||||||
|
@ -137,7 +137,8 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
|
|||||||
|
|
||||||
const dragBoundFunc = useCallback(
|
const dragBoundFunc = useCallback(
|
||||||
(position: Vector2d) => {
|
(position: Vector2d) => {
|
||||||
if (!baseCanvasImage) return boundingBoxCoordinates;
|
if (!baseCanvasImage && activeTabName !== 'outpainting')
|
||||||
|
return boundingBoxCoordinates;
|
||||||
|
|
||||||
const { x, y } = position;
|
const { x, y } = position;
|
||||||
|
|
||||||
@ -153,6 +154,7 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
|
|||||||
},
|
},
|
||||||
[
|
[
|
||||||
baseCanvasImage,
|
baseCanvasImage,
|
||||||
|
activeTabName,
|
||||||
boundingBoxCoordinates,
|
boundingBoxCoordinates,
|
||||||
stageDimensions.width,
|
stageDimensions.width,
|
||||||
stageDimensions.height,
|
stageDimensions.height,
|
||||||
@ -236,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 = {
|
||||||
@ -267,7 +269,8 @@ 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) return oldBoundBox;
|
if (!baseCanvasImage && activeTabName !== 'outpainting')
|
||||||
|
return oldBoundBox;
|
||||||
if (
|
if (
|
||||||
newBoundBox.width + newBoundBox.x > stageDimensions.width ||
|
newBoundBox.width + newBoundBox.x > stageDimensions.width ||
|
||||||
newBoundBox.height + newBoundBox.y > stageDimensions.height ||
|
newBoundBox.height + newBoundBox.y > stageDimensions.height ||
|
||||||
@ -279,7 +282,12 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
|
|||||||
|
|
||||||
return newBoundBox;
|
return newBoundBox;
|
||||||
},
|
},
|
||||||
[baseCanvasImage, stageDimensions]
|
[
|
||||||
|
activeTabName,
|
||||||
|
baseCanvasImage,
|
||||||
|
stageDimensions.height,
|
||||||
|
stageDimensions.width,
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleStartedTransforming = () => {
|
const handleStartedTransforming = () => {
|
||||||
@ -333,9 +341,7 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
|
|||||||
globalCompositeOperation={'destination-out'}
|
globalCompositeOperation={'destination-out'}
|
||||||
/>
|
/>
|
||||||
<Rect
|
<Rect
|
||||||
dragBoundFunc={
|
{...(activeTabName === 'inpainting' ? { dragBoundFunc } : {})}
|
||||||
activeTabName === 'inpainting' ? dragBoundFunc : undefined
|
|
||||||
}
|
|
||||||
listening={!isDrawing && tool === 'move'}
|
listening={!isDrawing && tool === 'move'}
|
||||||
draggable={true}
|
draggable={true}
|
||||||
fillEnabled={false}
|
fillEnabled={false}
|
||||||
|
@ -34,8 +34,10 @@ const IAICanvasResizer = () => {
|
|||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
if (!ref.current || !baseCanvasImage) return;
|
if (!ref.current) return;
|
||||||
const { width: imageWidth, height: imageHeight } = baseCanvasImage.image;
|
const { width: imageWidth, height: imageHeight } = baseCanvasImage?.image
|
||||||
|
? baseCanvasImage.image
|
||||||
|
: { width: 512, height: 512 };
|
||||||
const { clientWidth, clientHeight } = ref.current;
|
const { clientWidth, clientHeight } = ref.current;
|
||||||
|
|
||||||
const scale = Math.min(
|
const scale = Math.min(
|
||||||
|
@ -413,18 +413,18 @@ export const canvasSlice = createSlice({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
setBoundingBoxDimensions: (state, action: PayloadAction<Dimensions>) => {
|
setBoundingBoxDimensions: (state, action: PayloadAction<Dimensions>) => {
|
||||||
state[state.currentCanvas].boundingBoxDimensions = action.payload;
|
const currentCanvas = state[state.currentCanvas];
|
||||||
|
currentCanvas.boundingBoxDimensions = action.payload;
|
||||||
|
|
||||||
const { width: boundingBoxWidth, height: boundingBoxHeight } =
|
const { width: boundingBoxWidth, height: boundingBoxHeight } =
|
||||||
action.payload;
|
action.payload;
|
||||||
const { x: boundingBoxX, y: boundingBoxY } =
|
const { x: boundingBoxX, y: boundingBoxY } =
|
||||||
state[state.currentCanvas].boundingBoxCoordinates;
|
currentCanvas.boundingBoxCoordinates;
|
||||||
const { width: canvasWidth, height: canvasHeight } =
|
const { width: canvasWidth, height: canvasHeight } =
|
||||||
state[state.currentCanvas].stageDimensions;
|
currentCanvas.stageDimensions;
|
||||||
|
|
||||||
const scaledCanvasWidth =
|
const scaledCanvasWidth = canvasWidth / currentCanvas.stageScale;
|
||||||
canvasWidth / state[state.currentCanvas].stageScale;
|
const scaledCanvasHeight = canvasHeight / currentCanvas.stageScale;
|
||||||
const scaledCanvasHeight =
|
|
||||||
canvasHeight / state[state.currentCanvas].stageScale;
|
|
||||||
|
|
||||||
const roundedCanvasWidth = roundDownToMultiple(scaledCanvasWidth, 64);
|
const roundedCanvasWidth = roundDownToMultiple(scaledCanvasWidth, 64);
|
||||||
const roundedCanvasHeight = roundDownToMultiple(scaledCanvasHeight, 64);
|
const roundedCanvasHeight = roundDownToMultiple(scaledCanvasHeight, 64);
|
||||||
@ -458,22 +458,22 @@ export const canvasSlice = createSlice({
|
|||||||
|
|
||||||
const clampedX = _.clamp(
|
const clampedX = _.clamp(
|
||||||
overflowCorrectedX,
|
overflowCorrectedX,
|
||||||
state[state.currentCanvas].stageCoordinates.x,
|
currentCanvas.stageCoordinates.x,
|
||||||
roundedCanvasWidth - newBoundingBoxWidth
|
roundedCanvasWidth - newBoundingBoxWidth
|
||||||
);
|
);
|
||||||
|
|
||||||
const clampedY = _.clamp(
|
const clampedY = _.clamp(
|
||||||
overflowCorrectedY,
|
overflowCorrectedY,
|
||||||
state[state.currentCanvas].stageCoordinates.y,
|
currentCanvas.stageCoordinates.y,
|
||||||
roundedCanvasHeight - newBoundingBoxHeight
|
roundedCanvasHeight - newBoundingBoxHeight
|
||||||
);
|
);
|
||||||
|
|
||||||
state[state.currentCanvas].boundingBoxDimensions = {
|
currentCanvas.boundingBoxDimensions = {
|
||||||
width: newBoundingBoxWidth,
|
width: newBoundingBoxWidth,
|
||||||
height: newBoundingBoxHeight,
|
height: newBoundingBoxHeight,
|
||||||
};
|
};
|
||||||
|
|
||||||
state[state.currentCanvas].boundingBoxCoordinates = {
|
currentCanvas.boundingBoxCoordinates = {
|
||||||
x: clampedX,
|
x: clampedX,
|
||||||
y: clampedY,
|
y: clampedY,
|
||||||
};
|
};
|
||||||
|
@ -61,7 +61,15 @@ const OutpaintingDisplay = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'workarea-single-view'}>
|
<div className={'workarea-single-view'}>
|
||||||
<div className="workarea-split-view-left">{outpaintingComponent}</div>
|
<div className="workarea-split-view-left">
|
||||||
|
<div className="inpainting-main-area">
|
||||||
|
<IAICanvasOutpaintingControls />
|
||||||
|
<div className="inpainting-canvas-area">
|
||||||
|
{doesCanvasNeedScaling ? <IAICanvasResizer /> : <IAICanvas />}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* <div className="workarea-split-view-left">{outpaintingComponent}</div> */}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user