diff --git a/changelog.md b/changelog.md index 4e86605..58cd39b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## [0.0.5] - 2024/10/06 + +### Fixed + +- Image animation does not work correctly when using `yoffset` and `invertY + ## [0.0.5-beta.1] - 2024/10/04 ### Fixed diff --git a/package.json b/package.json index 0c0f54f..81fea7b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "narraleaf-react", - "version": "0.0.5-beta.1", + "version": "0.0.5", "description": "A React visual novel player framework", "main": "./dist/main.js", "types": "./dist/index.d.ts", diff --git a/src/game/nlcore/elements/transform/position.ts b/src/game/nlcore/elements/transform/position.ts index 0b71ab4..84a045a 100644 --- a/src/game/nlcore/elements/transform/position.ts +++ b/src/game/nlcore/elements/transform/position.ts @@ -80,10 +80,10 @@ export class PositionUtils { return "auto"; } if (offset === undefined || PositionUtils.isUnknown(offset)) { - return `${pos}`; + return `calc(${pos} + 0px)`; } const left = typeof pos === "number" ? `${pos}px` : pos; - return `calc(${left} + ${offset}px)`; + return `calc(${left} + (${offset}px))`; } static toCoord2D(pos: IPosition | D2Position): Coord2D { diff --git a/src/game/nlcore/elements/transform/transform.ts b/src/game/nlcore/elements/transform/transform.ts index ac6d04a..5e69098 100644 --- a/src/game/nlcore/elements/transform/transform.ts +++ b/src/game/nlcore/elements/transform/transform.ts @@ -184,6 +184,8 @@ export class Transform { Object.assign(current["style"], this.propToCSS(gameState, image.state as any, overwrites)); diff --git a/src/game/player/elements/image/Image.tsx b/src/game/player/elements/image/Image.tsx index 08d3682..fe58562 100644 --- a/src/game/player/elements/image/Image.tsx +++ b/src/game/player/elements/image/Image.tsx @@ -131,15 +131,6 @@ export default function Image({ { type: GameImage.EventTypes["event:image.flushComponent"], listener: image.events.on(GameImage.EventTypes["event:image.flushComponent"], async () => { - // state.stage.update(); - // await new Promise(resolve => { - // // It is hard to explain why this is needed, but it is needed - // // react does not flush between some microtasks - // // So we need to wait for the next microtask - // setTimeout(() => { - // resolve(); - // }, 10); - // }); return true; }) } @@ -229,7 +220,6 @@ export default function Image({ } : {}) }, }; - state.logger.debug("image props", defaultProps, image.state, image.state.src); return ( @@ -266,8 +256,9 @@ export default function Image({ (defaultProps, {})} onLoad={handleLoad} + layout /> )} {(() => {