perf(ui): reset maskobjects when layer has no bbox (all objects erased)

This commit is contained in:
psychedelicious 2024-04-30 13:07:45 +10:00 committed by Kent Keirsey
parent aa2ca03056
commit 415a41e21a

View File

@ -181,6 +181,11 @@ export const regionalPromptsSlice = createSlice({
if (isRenderableLayer(layer)) {
layer.bbox = bbox;
layer.bboxNeedsUpdate = false;
if (bbox === null && layer.type === 'masked_guidance_layer') {
// The layer was fully erased, empty its objects to prevent accumulation of invisible objects
layer.maskObjects = [];
layer.needsPixelBbox = false;
}
}
},
layerReset: (state, action: PayloadAction<string>) => {