Skip to content

Commit 9e1dd8a

Browse files
psychedelicioushipsterusername
authored andcommitted
fix(ui): reset canvas coords/dims on reset
1 parent ebd68b7 commit 9e1dd8a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

invokeai/frontend/web/src/features/canvas/store/canvasSlice.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,31 @@ export const canvasSlice = createSlice({
462462
},
463463
resetCanvas: (state) => {
464464
state.pastLayerStates.push(cloneDeep(state.layerState));
465-
466465
state.layerState = cloneDeep(initialLayerState);
467466
state.futureLayerStates = [];
468467
state.batchIds = [];
468+
state.boundingBoxCoordinates = {
469+
...initialCanvasState.boundingBoxCoordinates,
470+
};
471+
state.boundingBoxDimensions = {
472+
...initialCanvasState.boundingBoxDimensions,
473+
};
474+
state.stageScale = calculateScale(
475+
state.stageDimensions.width,
476+
state.stageDimensions.height,
477+
state.boundingBoxDimensions.width,
478+
state.boundingBoxDimensions.height,
479+
STAGE_PADDING_PERCENTAGE
480+
);
481+
state.stageCoordinates = calculateCoordinates(
482+
state.stageDimensions.width,
483+
state.stageDimensions.height,
484+
0,
485+
0,
486+
state.boundingBoxDimensions.width,
487+
state.boundingBoxDimensions.height,
488+
1
489+
);
469490
},
470491
canvasResized: (
471492
state,

0 commit comments

Comments
 (0)