From 3a59697a434167f7a0890c30a12d6d5aef79d02d Mon Sep 17 00:00:00 2001 From: JeffY Date: Wed, 28 Jan 2026 13:52:36 +0800 Subject: [PATCH] Added place for defining default width and height for spritesheet --- src/schemas/projectData/resources.yaml | 6 ++++++ src/stores/constructRenderState.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/schemas/projectData/resources.yaml b/src/schemas/projectData/resources.yaml index 188575f..4b6f343 100644 --- a/src/schemas/projectData/resources.yaml +++ b/src/schemas/projectData/resources.yaml @@ -78,6 +78,12 @@ properties: jsonData: type: object description: The JSON metadata (frames, meta) + width: + type: integer + description: Default width for the animated sprite + height: + type: integer + description: Default height for the animated sprite animations: type: object description: Map of named animations diff --git a/src/stores/constructRenderState.js b/src/stores/constructRenderState.js index c13dd97..c2f9e8f 100644 --- a/src/stores/constructRenderState.js +++ b/src/stores/constructRenderState.js @@ -353,8 +353,8 @@ export const addVisuals = ( type: "animated-sprite", x: item.x ?? transform.x ?? 0, y: item.y ?? transform.y ?? 0, - width: item.width, - height: item.height, + width: item.width ?? spritesheet.width, + height: item.height ?? spritesheet.height, alpha: item.alpha ?? 1, anchorX: transform.anchorX, anchorY: transform.anchorY,