Closed usuiat closed 9 months ago
I ran into this recently. How do you think we could disable swiping gesture when pinching? I tried to disable nested scoll consumption with
[...]
var pagerScrollEnabled by remember { mutableStateOf(true) }
HorizontalPager(
state = pagerState,
modifier = Modifier.disabledHorizontalPointerInputScroll(!pagerScrollEnabled)
)
[...]
private val HorizontalScrollConsumer =
object : NestedScrollConnection {
override fun onPreScroll(available: Offset, source: NestedScrollSource) =
available.copy(y = 0f)
override suspend fun onPreFling(available: Velocity) = available.copy(y = 0f)
}
fun Modifier.disabledHorizontalPointerInputScroll(disabled: Boolean = true) =
if (disabled) this.nestedScroll(HorizontalScrollConsumer) else this
But it give weird behaviour. If you have a better solution.
@romainbsl I have confirmed that the cause of thie issue lies in the touch slop detection. I'm currently fixing it.
@IacobIonut01 Thank you for sharing the workaround.
It is more difficult and time consuming than I expected. I may need to consider nested scroll. Sorry for the delay.
That's the way I do it
Sadly it's quite buggy for me on my Pixel 6 Pro. Sometimes the whole layout freeze so I can't do anything. And sometimes there are some UI glitches. I tested this in the Gallery apk on your Github
That's the way I do it
Sadly it's quite buggy for me on my Pixel 6 Pro. Sometimes the whole layout freeze so I can't do anything. And sometimes there are some UI glitches. I tested this in the Gallery apk on your Github
Unless you actually try to make the bug, it's pretty usable for day to day
@romainbsl @latsson @IacobIonut01 I am very sorry for the delay, but I was able to resolve this Issue. However, as noted in the PR #125 , the API will be changed. If you have any opinions, comments are welcome.
You can try with v1.6.0-beta1
I found better way to solve this issue and merged #143. Please try the beta release, v1.6.0-beta3
I will close this issue but feel free to ask any question.
Pinch gestures to an Image placed on a HorizontalPager may cause the image to expand and the page to swipe at the same time. While pinch gestures are detected, swiping page should be disabled.
Attached is a video of this issue. it is slow playback.
https://github.com/usuiat/Zoomable/assets/17829294/c078ffc0-4912-4ed5-b755-9542f27ea856