From 8a4e14750b9a9e148cf3fcd391150d7a50cb4d89 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 7 Jan 2026 16:39:13 +0100 Subject: [PATCH] Fix --- src/composables/useLayers.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/composables/useLayers.ts b/src/composables/useLayers.ts index d8b78eb..0078025 100644 --- a/src/composables/useLayers.ts +++ b/src/composables/useLayers.ts @@ -153,7 +153,15 @@ export const useLayers = () => { URL.revokeObjectURL(s.url); } catch {} } - l.sprites.splice(i, 1); + + if (layers.value.length > 1) { + // If there are multiple layers, we want to maintain frame alignment + // so we replace the sprite with an empty one instead of shifting + l.sprites[i] = createEmptySprite(); + } else { + // If there's only one layer, we can safely remove the frame + l.sprites.splice(i, 1); + } }; const removeSprites = (ids: string[]) => { @@ -175,7 +183,12 @@ export const useLayers = () => { URL.revokeObjectURL(s.url); } catch {} } - l.sprites.splice(i, 1); + + if (layers.value.length > 1) { + l.sprites[i] = createEmptySprite(); + } else { + l.sprites.splice(i, 1); + } }); };