Fix for scrolling up past images in the comments jerks you back down #845
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.
Closes #730
Closes #825
This happens only with images that go beyond the available canvas width. The attached videos shows 2 images one after another and the jerk down only occurs for the larger image which is of res 1600x1200 while only 990px was the available width.
This seems to be a problem with the
CoilImagePlugin
(or maybe that's how it's meant to behave) which doesn't call the image resolver if the canvas width is not known. The canvas width is obtained during the first paint call.So, the initial bounds are 1600x1200 and during the first paint call, it realizes the image won't fit and reduces the bounds based on the canvas width. My assumption is this change in bounds is picked up by the lazy column and the jerk down happens trying to maintain the scroll position.
Other ways to test this:
To solve this, I tried wrapping the
AndroidTextView
with aBoxWithConstraints
and initialized the canvas width ofAsyncDrawable
with the maxWidth available. This seems to work. After the first paint call the canvas width is picked up and there is no (or minimum) change in bounds. Changing orientation of the device also works as intended.bug.mov
fix.mov
Link to the post in the above videos.