mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): reset canvas coords/dims on reset
This commit is contained in:
parent
ebd68b7a6c
commit
9e1dd8ac9c
@ -462,10 +462,31 @@ export const canvasSlice = createSlice({
|
|||||||
},
|
},
|
||||||
resetCanvas: (state) => {
|
resetCanvas: (state) => {
|
||||||
state.pastLayerStates.push(cloneDeep(state.layerState));
|
state.pastLayerStates.push(cloneDeep(state.layerState));
|
||||||
|
|
||||||
state.layerState = cloneDeep(initialLayerState);
|
state.layerState = cloneDeep(initialLayerState);
|
||||||
state.futureLayerStates = [];
|
state.futureLayerStates = [];
|
||||||
state.batchIds = [];
|
state.batchIds = [];
|
||||||
|
state.boundingBoxCoordinates = {
|
||||||
|
...initialCanvasState.boundingBoxCoordinates,
|
||||||
|
};
|
||||||
|
state.boundingBoxDimensions = {
|
||||||
|
...initialCanvasState.boundingBoxDimensions,
|
||||||
|
};
|
||||||
|
state.stageScale = calculateScale(
|
||||||
|
state.stageDimensions.width,
|
||||||
|
state.stageDimensions.height,
|
||||||
|
state.boundingBoxDimensions.width,
|
||||||
|
state.boundingBoxDimensions.height,
|
||||||
|
STAGE_PADDING_PERCENTAGE
|
||||||
|
);
|
||||||
|
state.stageCoordinates = calculateCoordinates(
|
||||||
|
state.stageDimensions.width,
|
||||||
|
state.stageDimensions.height,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
state.boundingBoxDimensions.width,
|
||||||
|
state.boundingBoxDimensions.height,
|
||||||
|
1
|
||||||
|
);
|
||||||
},
|
},
|
||||||
canvasResized: (
|
canvasResized: (
|
||||||
state,
|
state,
|
||||||
|
Loading…
Reference in New Issue
Block a user