Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@0xZhangKe
Copy link

When I use it in conjunction HorizontalPager, I've found that sometimes swiping left or right doesn't work.

After some troubleshooting, I found that the problem occurs when the Offset is judged to be zero.

The currentOffset maybe get -0.0F value, even though -0.0F == 0.0F, but Offset(-0F, 0.F) != Offset(0F, 0F).

This is a problem caused by the algorithm of the packFloats function.

So we can only determine if Offset is 0 by looking at the x and y values.

@0xZhangKe 0xZhangKe requested a review from fornewid as a code owner September 3, 2023 12:05
@0xZhangKe
Copy link
Author

Looks like PhotoBoxInPagerDemo is correct!

I'm guessing it might be an inconsistency in the version of HorizontalPager, which I'm using compose foundation HorizontalPager.

@fornewid
Copy link
Owner

fornewid commented Sep 7, 2023

@0xZhangKe
First, thanks for reporting! πŸ˜ƒ
Recently I've been focusing on preparing a presentation.
So, sorry for the late.

Could you please provide the example code and video that reproduces it?

@0xZhangKe
Copy link
Author

0xZhangKe commented Sep 12, 2023

@fornewid
I've created a demo branch to reproduce the problem.
https://github.com/0xZhangKe/photo-compose/tree/pager_test

Also you can see this screenshot.
image

As shown above.

@0xZhangKe
Copy link
Author

Also, I found one more thing about Pager, If you run the code in the demo branch above, you'll notice that you can't swipe left or right.
It looks like this is caused by a sliding conflict between Pager and PhotoBox.

transformable function will consume this MotionEvent, so Pager can't drag.

I've taken a more ad hoc approach in one of my other projects by providing a transformable function that doesn't consume events.

@fornewid
Copy link
Owner

@0xZhangKe
Thank you for reporting the scrolling issue that occurred when using compose foundation's Pager.
I'll check that again. πŸ‘ πŸ‘ πŸ‘

And I have a question about the -0.0F value issue.
I couldn't reproduce this issue.
Could you please explain the reproducible path in more detail? πŸ™‡

@0xZhangKe
Copy link
Author

Okay, first run the code of the branch I posted in the previous comment.
Then continue to quickly slide the pictures in the app left and right.
At this time, open logcat and you can see the situation in the picture above.
It can be seen that even if the x and y of Offset are both 0, it is still not equal to Offset.Zero.

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.

2 participants