[FEAT] Open project bug fix

This commit is contained in:
2026-01-07 16:20:08 +01:00
parent f9635ba044
commit bcc2faca35
2 changed files with 43 additions and 3 deletions

View File

@@ -164,6 +164,26 @@ export const useExportLayers = (layersRef: Ref<Layer[]>, columns: Ref<number>, n
const file = new File([blob], fileName, { type: mimeType });
resolve({ id: spriteData.id || crypto.randomUUID(), file, img, url: spriteData.base64, width: spriteData.width, height: spriteData.height, x: spriteData.x || 0, y: spriteData.y || 0, rotation: spriteData.rotation || 0, flipX: spriteData.flipX || false, flipY: spriteData.flipY || false });
};
img.onerror = () => {
console.error('Failed to load sprite image:', spriteData.name);
// Create a 1x1 transparent placeholder or similar to avoid breaking the entire project load
// For now, we'll just resolve with a "broken" sprite but maybe with 0 width/height effectively
// or we could construct a dummy file.
// Let's resolve with a valid but empty/placeholder structure to let other sprites load.
resolve({
id: spriteData.id || crypto.randomUUID(),
file: new File([], 'broken-image'),
img: new Image(), // Empty image
url: '',
width: 0,
height: 0,
x: spriteData.x || 0,
y: spriteData.y || 0,
rotation: 0,
flipX: false,
flipY: false,
});
};
img.src = spriteData.base64;
});