[FEAT] Open project bug fix
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user