mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): discarding last single canvas image breaks canvas
We need to reset the staging area if we are discarding the last image.
This commit is contained in:
parent
8a32baf2dc
commit
13027891d9
@ -289,12 +289,19 @@ export const canvasSlice = createSlice({
|
|||||||
const { images, selectedImageIndex } = state.layerState.stagingArea;
|
const { images, selectedImageIndex } = state.layerState.stagingArea;
|
||||||
pushToPrevLayerStates(state);
|
pushToPrevLayerStates(state);
|
||||||
|
|
||||||
if (!images.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
images.splice(selectedImageIndex, 1);
|
images.splice(selectedImageIndex, 1);
|
||||||
|
|
||||||
|
if (images.length === 0) {
|
||||||
|
pushToPrevLayerStates(state);
|
||||||
|
|
||||||
|
state.layerState.stagingArea = deepClone(initialLayerState.stagingArea);
|
||||||
|
|
||||||
|
state.futureLayerStates = [];
|
||||||
|
state.shouldShowStagingOutline = true;
|
||||||
|
state.shouldShowStagingImage = true;
|
||||||
|
state.batchIds = [];
|
||||||
|
}
|
||||||
|
|
||||||
if (selectedImageIndex >= images.length) {
|
if (selectedImageIndex >= images.length) {
|
||||||
state.layerState.stagingArea.selectedImageIndex = images.length - 1;
|
state.layerState.stagingArea.selectedImageIndex = images.length - 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user