fix(ui): add missed ca layer opacity logic

didn't stage the right changes a few commits back
This commit is contained in:
psychedelicious 2024-04-30 12:03:36 +10:00 committed by Kent Keirsey
parent 1f68a60752
commit fa637b5c59

View File

@ -40,7 +40,7 @@ export const initialRegionalPromptsState: RegionalPromptsState = {
selectedLayerId: null,
brushSize: 100,
layers: [],
globalMaskLayerOpacity: 0.5, // this globally changes all mask layers' opacity
globalMaskLayerOpacity: 0.3, // this globally changes all mask layers' opacity
isEnabled: true,
positivePrompt: '',
negativePrompt: '',
@ -217,6 +217,13 @@ export const regionalPromptsSlice = createSlice({
state.layers = state.layers.filter((l) => l.id !== state.selectedLayerId);
state.selectedLayerId = state.layers[0]?.id ?? null;
},
layerOpacityChanged: (state, action: PayloadAction<{ layerId: string; opacity: number }>) => {
const { layerId, opacity } = action.payload;
const layer = state.layers.filter(isControlAdapterLayer).find((l) => l.id === layerId);
if (layer) {
layer.opacity = opacity;
}
},
//#endregion
//#region Mask Layers
@ -500,6 +507,7 @@ export const {
maskedGuidanceLayerAdded,
ipAdapterLayerAdded,
controlAdapterLayerAdded,
layerOpacityChanged,
// Mask layer actions
maskLayerLineAdded,
maskLayerPointsAdded,