Skip to content

Resize artboard every frame for Fit.LAYOUT#450

Draft
mfazekas wants to merge 1 commit intorive-app:masterfrom
mfazekas:fix/fit-layout-per-frame-resize
Draft

Resize artboard every frame for Fit.LAYOUT#450
mfazekas wants to merge 1 commit intorive-app:masterfrom
mfazekas:fix/fit-layout-per-frame-resize

Conversation

@mfazekas
Copy link
Copy Markdown
Contributor

Fixes #446 (issue 2)

Problem

State machine keyframes can overwrite m_Width every frame via CoreRegistry::setDouble(artboard, widthPropertyKey, ...) during advance(). Since resizeArtboard() only runs once (one-shot requireArtboardResize flag), the artboard stays at the keyframe value.

Reproduced with layout_test.riv — 9/10 launches show wrong artboard width.

For reference, iOS re-applies artboard dimensions every frame in drawRive rather than using a one-shot flag.

Changes

  1. RiveArtboardRenderer.draw() — call resizeArtboard() every frame when fit == Fit.LAYOUT
  2. RiveArtboardRenderer.resizeArtboard() — re-arm flag when artboard is null or surface is 0×0
  3. RiveAnimationView.onSurfaceTextureSizeChanged/Available() — set requireArtboardResize = true

Verified

layout_test.riv — 9/10 wrong before fix, 10/10 correct after.

State machine keyframes can overwrite artboard width via
CoreRegistry::setDouble during advance(). The one-shot
requireArtboardResize flag is already consumed, so the artboard stays
at the keyframe value. iOS re-applies artboard dimensions every frame
in drawRive; this matches that behavior.

Also re-arm requireArtboardResize when artboard is null or surface is
0x0, and set it in onSurfaceTextureSizeChanged/Available.

Fixes rive-app#446 (issue 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fit.LAYOUT artboard size incorrect when onMeasure is deferred or state machine animates artboard width

1 participant