saket / telephoto

Building blocks for designing media experiences in Compose UI
https://saket.github.io/telephoto/
Apache License 2.0
869 stars 28 forks source link

Difficult to zoom inside pager #60

Closed kmnaseef closed 4 months ago

kmnaseef commented 6 months ago

https://github.com/saket/telephoto/assets/13997049/79ec8ea4-0571-49f5-b235-d299fab30113

While trying to pinch zoom ZoomableAsyncImage used inside a HorizontalPager/VerticalPager, most of the time the pager changes the page instead of zooming. How I overcome this issue?

saket commented 5 months ago

Can this be reproduced in the sample by replacing the HorizontalPager with a VerticalPager? https://github.com/saket/telephoto/blob/d8c19c77fe58f8cbff4dd0ac1904a176a61aa64c/sample/src/main/kotlin/me/saket/telephoto/sample/viewer/MediaViewerScreen.kt#L45

kmnaseef commented 5 months ago

yea. have the same issue for verticalPager also. only the direction changes. is it possible to introduce a threshold to the horizontalPager/verticalPager for detecting drag?

saket commented 5 months ago

Can you share a video of telephoto's sample app with this problem? I can't seem to reproduce it.

saket commented 4 months ago

most of the time the pager changes the page instead of zooming

Here's a different theory: is this issue happening only when the placeholder image is visible? You can confirm this by adding a loading indicator while the full image is loading:

if (!imageState.isImageDisplayed) {
  CircularProgressIndicator()
}
kmnaseef commented 4 months ago

Sorry for late reply. Problem exist for telephoto app also.

https://github.com/saket/telephoto/assets/13997049/5925d964-5cd4-46d8-beea-3d00f0563ddb

saket commented 4 months ago

Thanks @kmnaseef! I made a small improvement to consume gestures immediately if multiple fingers/pointers are detected in https://github.com/saket/telephoto/commit/4c9118e1680efafc2c6b7b33319f2e281dfc7532. Can you give 0.8.0-SNAPSHOT a try?

kmnaseef commented 4 months ago

Perfect bro... thank you very much..

saket commented 4 months ago

FWIW I filed a bug report against Compose UI because I believe the bug lies inside Modifier.transformable(): https://issuetracker.google.com/issues/325807994.