Tlaster / Zoomable

Easy zoom in and out with drag support for Jetpack Compose
MIT License
80 stars 6 forks source link

Weird behavior when wrapped in HorizontalPager #2

Closed b95505017 closed 3 years ago

b95505017 commented 3 years ago

I'm not sure where this issue should belongs to.

In traditional Pager2 & PhotoView world, I could keep dragging a zoomed photo without flip to next page until I drag to the edge of the photo. But in Zoomable it would flip to next/previous page anytime I drag horizontally.

Tlaster commented 3 years ago

It might due to the handling of pointer input differences between Zoomable and HorizontalPager. I haven't look into HorizontalPager yet but I think I can fix it (if you're using accompanist's HorizontalPager).

b95505017 commented 3 years ago

Thanks! Yes I'm using accompanist's HorizontalPager.

Tlaster commented 3 years ago

Hi, I've tested Zoomable with HorizontalPager but I can not reproduce the issue, can you provide a sample that can reproduce the issue?

b95505017 commented 3 years ago

@Tlaster Just try latest sample, now the behavior changed. I can't flip to next page until I zoom out to original size.

Tlaster commented 3 years ago

This behavior is by design right now, there's only PointerInputChange.consumePositionChange(), which means that we can only consume both Y change and X change, not a single of them. For example when we drag to the right edge of child and try to drag to the next pager's page, but the child still can be dragged vertically, so it's hard to determinate whether the Zoomable should consume the touch event. I remember there's PointerInputChange.consumePositionChange(x, y) before which can consume the right X or Y change, but it's gone now.

b95505017 commented 3 years ago

Got it, thanks for investigation!