From c612f18114b868f80e1302c87a43323778a0cd35 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:38:09 +1000 Subject: [PATCH] fix(ui): missing rasterization cache invalidations --- .../web/src/features/controlLayers/store/canvasV2Slice.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/invokeai/frontend/web/src/features/controlLayers/store/canvasV2Slice.ts b/invokeai/frontend/web/src/features/controlLayers/store/canvasV2Slice.ts index 0101170544..dc6b5b53e1 100644 --- a/invokeai/frontend/web/src/features/controlLayers/store/canvasV2Slice.ts +++ b/invokeai/frontend/web/src/features/controlLayers/store/canvasV2Slice.ts @@ -334,9 +334,9 @@ export const canvasV2Slice = createSlice({ let selectedEntityIdentifier: CanvasEntityIdentifier = { type: state.inpaintMask.type, id: state.inpaintMask.id }; if (entityIdentifier.type === 'raster_layer') { - // When deleting a raster layer, we need to invalidate the composite rasterization cache. const index = state.rasterLayers.entities.findIndex((layer) => layer.id === entityIdentifier.id); state.rasterLayers.entities = state.rasterLayers.entities.filter((layer) => layer.id !== entityIdentifier.id); + // When deleting a raster layer, we need to invalidate the composite rasterization cache. state.rasterLayers.compositeRasterizationCache = []; const nextRasterLayer = state.rasterLayers.entities[index]; if (nextRasterLayer) { @@ -410,6 +410,7 @@ export const canvasV2Slice = createSlice({ if (entity.type === 'raster_layer') { moveOneToStart(state.rasterLayers.entities, entity); // When arranging a raster layer, we need to invalidate the composite rasterization cache. + state.rasterLayers.compositeRasterizationCache = []; } else if (entity.type === 'control_layer') { moveOneToStart(state.controlLayers.entities, entity); } else if (entity.type === 'regional_guidance') { @@ -423,6 +424,7 @@ export const canvasV2Slice = createSlice({ return; } if (entity.type === 'raster_layer') { + // When arranging a raster layer, we need to invalidate the composite rasterization cache. moveToStart(state.rasterLayers.entities, entity); state.rasterLayers.compositeRasterizationCache = []; } else if (entity.type === 'control_layer') { @@ -441,6 +443,7 @@ export const canvasV2Slice = createSlice({ return; } entity.opacity = opacity; + invalidateRasterizationCaches(entity, state); }, allEntitiesOfTypeToggled: (state, action: PayloadAction<{ type: CanvasEntityIdentifier['type'] }>) => { const { type } = action.payload;