This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val scaleDetector = ScaleGestureDetector(context, listener) | |
override fun onTouchEvent(event: MotionEvent) : Boolean { | |
// Let the ScaleGestureDetector inspect all events | |
scaleDetector.onTouchEvent(event) | |
return true | |
} | |
val listener = object : ScaleGestureDetector.SimpleOnScaleGestureListener() { | |
override fun onScale(detector: ScaleGestureDetector): Boolean { | |
val scale = cameraControl.getZoomRatio.getValue() * detector.getScaleFactor() | |
} | |
} |
You can take a look at the source code of PreviewView and see how it handles the scale gesture.
Thanks
…On Sun, 13 Dec, 2020, 1:17 AM Xi Zhang, ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
You can take a look at
https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-master-dev/camera/camera-view/src/main/java/androidx/camera/view/PreviewView.java
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/f4edd06d8949a47335612934657d7146#gistcomment-3559408>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHH77CQJUYCSUVFZ7W2GNQDSUPCDRANCNFSM4UYJSJ3Q>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where to add this snipet ?