Repository navigation
Conversation
…ounds On devices where UIScreen.nativeScale != scale (Display Zoom, iPhone mini and Plus), MTKView derives its drawable size through ancestor transforms the first time it attaches to a window. Under a rotated parent the drawable gets the wrong aspect ratio and the artboard renders squashed; under a parent at scale(0) the size becomes infinite and the view stays blank. RiveUIView creates its MTKView asynchronously with automatic drawable sizing. Turn that off as soon as the MTKView is added (observed through the RiveUIView layer's sublayers, before the MTKView reaches the window) and size the drawable from the MTKView's bounds times the screen's nativeScale on layout and window changes. Legacy backend counterpart: #394. Fixes #393 for the new runtime.
3 tasks done
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New-runtime counterpart of #394, fixing #393 for the default backend. On devices where
nativeScale != scale(Display Zoom, iPhone mini and Plus),MTKViewderives its drawable size through ancestor transforms when it first attaches to a window, so aRiveViewunder a rotated parent renders squashed and one under ascale(0)parent stays blank.rive-ios's
RiveUIViewcreates itsMTKViewprivately and asynchronously, so this observes theRiveUIViewlayer'ssublayersto turn offautoResizeDrawablebefore theMTKViewreaches the window, then sizes the drawable from theMTKView's bounds ×nativeScaleon layout and window changes. This also keeps touch mapping right, sinceRiveUIViewmaps touches withcontentScaleFactoragainstdrawableSize. The proper fix belongs in rive-ios; this can go once it lands there.Verified on an iPhone 13 mini simulator (scale 3, nativeScale 2.88) with the new
Issue393DisplayZoomreproducer page, readingdrawableSizethrough lldb for 100×148 pt views:contentScaleFactor2.88, and no render errors.contentScaleFactor3.No automated test: CI's iPhone 16 Pro has
nativeScale == scale, so the bug can't trigger there.