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 {
|
||||
resetCanvas,
|
||||
resetCanvasView,
|
||||
resizeAndScaleCanvas,
|
||||
setTool,
|
||||
} from 'features/canvas/store/canvasSlice';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store';
|
||||
@ -131,7 +132,7 @@ const IAICanvasOutpaintingControls = () => {
|
||||
const handleSelectMoveTool = () => dispatch(setTool('move'));
|
||||
|
||||
const handleResetCanvasView = () => {
|
||||
const canvasBaseLayer = getCanvasBaseLayer()
|
||||
const canvasBaseLayer = getCanvasBaseLayer();
|
||||
if (!canvasBaseLayer) return;
|
||||
const clientRect = canvasBaseLayer.getClientRect({
|
||||
skipTransform: true,
|
||||
@ -143,7 +144,10 @@ const IAICanvasOutpaintingControls = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const handleResetCanvas = () => dispatch(resetCanvas());
|
||||
const handleResetCanvas = () => {
|
||||
dispatch(resetCanvas());
|
||||
dispatch(resizeAndScaleCanvas());
|
||||
};
|
||||
|
||||
const handleMergeVisible = () => {
|
||||
dispatch(mergeAndUploadCanvas({}));
|
||||
|
@ -394,8 +394,9 @@ export const canvasSlice = createSlice({
|
||||
);
|
||||
|
||||
state.stageScale = newScale;
|
||||
|
||||
state.stageCoordinates = newCoordinates;
|
||||
state.boundingBoxCoordinates = { x: 0, y: 0 };
|
||||
state.boundingBoxDimensions = { width: 512, height: 512 };
|
||||
return;
|
||||
}
|
||||
|
||||
@ -461,6 +462,8 @@ export const canvasSlice = createSlice({
|
||||
state.stageScale = newScale;
|
||||
|
||||
state.stageCoordinates = newCoordinates;
|
||||
state.boundingBoxCoordinates = { x: 0, y: 0 };
|
||||
state.boundingBoxDimensions = { width: 512, height: 512 };
|
||||
}
|
||||
},
|
||||
resetCanvasView: (
|
||||
@ -496,7 +499,6 @@ export const canvasSlice = createSlice({
|
||||
);
|
||||
|
||||
state.stageScale = newScale;
|
||||
|
||||
state.stageCoordinates = newCoordinates;
|
||||
} else {
|
||||
const newScale = calculateScale(
|
||||
@ -518,8 +520,9 @@ export const canvasSlice = createSlice({
|
||||
);
|
||||
|
||||
state.stageScale = newScale;
|
||||
|
||||
state.stageCoordinates = newCoordinates;
|
||||
state.boundingBoxCoordinates = { x: 0, y: 0 };
|
||||
state.boundingBoxDimensions = { width: 512, height: 512 };
|
||||
}
|
||||
},
|
||||
nextStagingAreaImage: (state) => {
|
||||
|
Loading…
Reference in New Issue
Block a user