mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Resets bounding box coords/dims when no image present
This commit is contained in:
parent
bb70c32ad5
commit
84f702b6d0
@ -3,6 +3,7 @@ import { createSelector } from '@reduxjs/toolkit';
|
|||||||
import {
|
import {
|
||||||
resetCanvas,
|
resetCanvas,
|
||||||
resetCanvasView,
|
resetCanvasView,
|
||||||
|
resizeAndScaleCanvas,
|
||||||
setTool,
|
setTool,
|
||||||
} from 'features/canvas/store/canvasSlice';
|
} from 'features/canvas/store/canvasSlice';
|
||||||
import { useAppDispatch, useAppSelector } from 'app/store';
|
import { useAppDispatch, useAppSelector } from 'app/store';
|
||||||
@ -131,7 +132,7 @@ const IAICanvasOutpaintingControls = () => {
|
|||||||
const handleSelectMoveTool = () => dispatch(setTool('move'));
|
const handleSelectMoveTool = () => dispatch(setTool('move'));
|
||||||
|
|
||||||
const handleResetCanvasView = () => {
|
const handleResetCanvasView = () => {
|
||||||
const canvasBaseLayer = getCanvasBaseLayer()
|
const canvasBaseLayer = getCanvasBaseLayer();
|
||||||
if (!canvasBaseLayer) return;
|
if (!canvasBaseLayer) return;
|
||||||
const clientRect = canvasBaseLayer.getClientRect({
|
const clientRect = canvasBaseLayer.getClientRect({
|
||||||
skipTransform: true,
|
skipTransform: true,
|
||||||
@ -143,7 +144,10 @@ const IAICanvasOutpaintingControls = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleResetCanvas = () => dispatch(resetCanvas());
|
const handleResetCanvas = () => {
|
||||||
|
dispatch(resetCanvas());
|
||||||
|
dispatch(resizeAndScaleCanvas());
|
||||||
|
};
|
||||||
|
|
||||||
const handleMergeVisible = () => {
|
const handleMergeVisible = () => {
|
||||||
dispatch(mergeAndUploadCanvas({}));
|
dispatch(mergeAndUploadCanvas({}));
|
||||||
|
@ -394,8 +394,9 @@ export const canvasSlice = createSlice({
|
|||||||
);
|
);
|
||||||
|
|
||||||
state.stageScale = newScale;
|
state.stageScale = newScale;
|
||||||
|
|
||||||
state.stageCoordinates = newCoordinates;
|
state.stageCoordinates = newCoordinates;
|
||||||
|
state.boundingBoxCoordinates = { x: 0, y: 0 };
|
||||||
|
state.boundingBoxDimensions = { width: 512, height: 512 };
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,6 +462,8 @@ export const canvasSlice = createSlice({
|
|||||||
state.stageScale = newScale;
|
state.stageScale = newScale;
|
||||||
|
|
||||||
state.stageCoordinates = newCoordinates;
|
state.stageCoordinates = newCoordinates;
|
||||||
|
state.boundingBoxCoordinates = { x: 0, y: 0 };
|
||||||
|
state.boundingBoxDimensions = { width: 512, height: 512 };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resetCanvasView: (
|
resetCanvasView: (
|
||||||
@ -496,7 +499,6 @@ export const canvasSlice = createSlice({
|
|||||||
);
|
);
|
||||||
|
|
||||||
state.stageScale = newScale;
|
state.stageScale = newScale;
|
||||||
|
|
||||||
state.stageCoordinates = newCoordinates;
|
state.stageCoordinates = newCoordinates;
|
||||||
} else {
|
} else {
|
||||||
const newScale = calculateScale(
|
const newScale = calculateScale(
|
||||||
@ -518,8 +520,9 @@ export const canvasSlice = createSlice({
|
|||||||
);
|
);
|
||||||
|
|
||||||
state.stageScale = newScale;
|
state.stageScale = newScale;
|
||||||
|
|
||||||
state.stageCoordinates = newCoordinates;
|
state.stageCoordinates = newCoordinates;
|
||||||
|
state.boundingBoxCoordinates = { x: 0, y: 0 };
|
||||||
|
state.boundingBoxDimensions = { width: 512, height: 512 };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
nextStagingAreaImage: (state) => {
|
nextStagingAreaImage: (state) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user