diff --git a/src/composables/useLayers.ts b/src/composables/useLayers.ts index 6bcd40d..a4c40ce 100644 --- a/src/composables/useLayers.ts +++ b/src/composables/useLayers.ts @@ -333,7 +333,8 @@ export const useLayers = () => { while (currentSprites.length < index) { currentSprites.push(createEmptySprite()); } - currentSprites.splice(index, 0, ...newSprites); + // Replace existing sprites at the target index instead of shifting them + currentSprites.splice(index, newSprites.length, ...newSprites); } else { currentSprites.push(...newSprites); }