mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-06-27 09:02:59 +02:00
disable flinging on preview view
- only change camera mode when fling happens on the bottom tab - so zoom gestures do not interfere with the fling
This commit is contained in:
@ -31,7 +31,6 @@ import com.simplemobiletools.camera.models.MySize
|
||||
import com.simplemobiletools.camera.models.ResolutionOption
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import kotlin.math.abs
|
||||
|
||||
class CameraXPreview(
|
||||
private val activity: AppCompatActivity,
|
||||
@ -46,7 +45,6 @@ class CameraXPreview(
|
||||
// Auto focus is 1/6 of the area.
|
||||
private const val AF_SIZE = 1.0f / 6.0f
|
||||
private const val AE_SIZE = AF_SIZE * 1.5f
|
||||
private const val MIN_SWIPE_DISTANCE_X = 100
|
||||
}
|
||||
|
||||
private val config = activity.config
|
||||
@ -293,21 +291,6 @@ class CameraXPreview(
|
||||
true
|
||||
} ?: false
|
||||
}
|
||||
|
||||
override fun onFling(event1: MotionEvent, event2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
|
||||
val deltaX = event1.x - event2.x
|
||||
val deltaXAbs = abs(deltaX)
|
||||
|
||||
if (deltaXAbs >= MIN_SWIPE_DISTANCE_X) {
|
||||
if (deltaX > 0) {
|
||||
listener.onSwipeLeft()
|
||||
} else {
|
||||
listener.onSwipeRight()
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
})
|
||||
previewView.setOnTouchListener { _, event ->
|
||||
val handledGesture = gestureDetector.onTouchEvent(event)
|
||||
|
Reference in New Issue
Block a user