Fixes bug where discarding staged images results in loss of history

This commit is contained in:
psychedelicious 2022-11-20 19:59:06 +11:00 committed by blessedcoolant
parent 80f6f9a931
commit d27d92325d

View File

@ -328,9 +328,17 @@ export const canvasSlice = createSlice({
state.futureLayerStates = [];
},
discardStagedImages: (state) => {
state.pastLayerStates.push(_.cloneDeep(state.layerState));
if (state.pastLayerStates.length > state.maxHistory) {
state.pastLayerStates.shift();
}
state.layerState.stagingArea = {
...initialLayerState.stagingArea,
};
state.futureLayerStates = [];
state.shouldShowStagingOutline = true;
},
addLine: (state, action: PayloadAction<number[]>) => {