-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The library is behaving weird in ViewPager2 The first page is fine but the rest of pages are not properly indented and Not zooming #184
Comments
Did you have a look at #37? |
Yes @markusressel before opening the issue I have searched for existing issues that one is for ViewPager and I have also tried the solutions that were provided there but none worked. |
Sorry, but I'm not sure how to help with this without a reproducable setup, and I'm very limited on time. I'll label this as a bug though so it won't be closed automatically. If you do find a solution, please let us know. |
Sure @markusressel I will definitely share the solution if I got one. |
I edit the override fun onTouchEvent(ev: MotionEvent): Boolean {
val interceptByEngine = engine.onTouchEvent(ev)
if (ev.pointerCount > 1) {
parent.requestDisallowInterceptTouchEvent(true)
}else{
if (engine.realZoom <= 1f){
parent.requestDisallowInterceptTouchEvent(false)
}else {
val maxAvailableOffset = engine.computeHorizontalScrollRange() - width
val isScrolledToViewEnd = engine.computeHorizontalScrollOffset().absoluteValue >= maxAvailableOffset
parent.requestDisallowInterceptTouchEvent(!isScrolledToViewEnd)
}
}
if (ev.actionMasked == MotionEvent.ACTION_UP){
parent.requestDisallowInterceptTouchEvent(false)
}
return interceptByEngine || hasClickableChildren && super.onTouchEvent(ev)
} |
Describe the bug
Please add a clear description of what the bug is, and fill the list below.
To Reproduce
Expected behavior
Full Image should be shown on each page with Zooming allowed
XML layout
Screenshots
The text was updated successfully, but these errors were encountered: