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
Double tap to zoom #2
Comments
For now, I have just implemented this functionality by my self with custom Gesture Listener class. Here is my code snippet if anyone need it.
then initialize these variables:
then assign your touchlistener to zoomimageview object:
and here is MyGestureListener class:
Please do on override onScroll (MUST) and other method (Optional in my case) which you don't have anything to deal with as it will conflict with ZoomImageView's touch event and create an issue. Hope this will help you. |
I'm currently reacting to double-tap to center the screen where the event was done. Simply by adding this:
Now I'm trying to move and zoom correctly. I can open a pull request if you want to make it work. |
@AlvaroFalcon that would be cool! I can give you some tips.
|
@natario1 Cool! I'll do it when I have some time... I'm currently working in my project with a class that extends your zoomlayout so I add my logic there. Thanks for the tips! |
Could an action be added in the moveTo() method? To be called after it finishes, I think it would be more flexible that way so you can do multiple things. Well, to moveTo, zoomBy, zoomTo, etc... It could be like:
|
@AlvaroFalcon In Kotlin I would do that but this is still pure Java. We will move to Kotlin in the future though. For now, there is |
@AlvaroFalcon were you able to achieve zoom and pan at the same time? mind sharing your code? |
I have implemented both double tap and pinch to zoom. The key to the working solution is to attach tap/double tap gesture detector to the content view inside zoom layout and configure zoom layout to have clickable children to true. Then in the onTouchEvent of the content view return true to consume touch events and pass them to the gesture detector. That way both pinch, zoom, and double tap work at the same time. Zooming in on double tap is no problem then. However, I have also tried to zoom to the area that was double tapped, and given how |
Yes, that's exactly what I've been trying to do. Any suggestions as to how to do this @natario1? |
Hi @mman We have also implemented a way to automatically zoom when the user taps the screen and the animation for zooming in kind of swirling toward the end position. It would be very good, if we could control this animation - do you or others have suggestions for how to go about that? Thanks in advance :) |
I managed to do it with a dirty hack. I am tricking the zoom engine into thinking that a pinch is taking place.
|
Hi, Thanks for the effort! :) That definitely seems like a bit of a hacky way of achieving it. I think we will however choose to live with the very animating animation for now. Thanks, |
Hi, Any news on how to achieve zooming + panning on a double tap? Thanks, |
It's common to react to double taps to control zoom. This should be a opt-in feature in
ZoomEngine
, enabled by default inZoomImageView
.The text was updated successfully, but these errors were encountered: