mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-05-28 20:40:17 +02:00
Made snapping only work when panned close to center.
This commit is contained in:
parent
2c7f02a24d
commit
b9c7e0a8ca
@ -9,7 +9,6 @@ import android.graphics.Matrix
|
|||||||
import android.graphics.drawable.Animatable
|
import android.graphics.drawable.Animatable
|
||||||
import android.media.AudioManager
|
import android.media.AudioManager
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.util.Log
|
|
||||||
import android.view.GestureDetector
|
import android.view.GestureDetector
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
@ -291,8 +290,6 @@ class GestureControlView : LinearLayout {
|
|||||||
_translationY = translationY.coerceAtLeast(ymin).coerceAtMost(ymax)
|
_translationY = translationY.coerceAtLeast(ymin).coerceAtMost(ymax)
|
||||||
|
|
||||||
onPan.emit(_translationX, _translationY)
|
onPan.emit(_translationX, _translationY)
|
||||||
|
|
||||||
Log.i(TAG, "surfaceView (width: ${_surfaceView?.width}, height: ${_surfaceView?.height}, x: ${_surfaceView?.x}, y: ${_surfaceView?.y}")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setupTouchArea(layoutControls: ViewGroup? = null, background: View? = null) {
|
fun setupTouchArea(layoutControls: ViewGroup? = null, background: View? = null) {
|
||||||
@ -382,11 +379,10 @@ class GestureControlView : LinearLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun willSnapFill(): Boolean {
|
private fun willSnapFill(): Boolean {
|
||||||
//TODO: Make sure pan is not too far away from 0, 0
|
|
||||||
val surfaceView = _surfaceView
|
val surfaceView = _surfaceView
|
||||||
if (surfaceView != null) {
|
if (surfaceView != null) {
|
||||||
val zoomScaleFactor = calculateZoomScaleFactor()
|
val zoomScaleFactor = calculateZoomScaleFactor()
|
||||||
if (Math.abs(_scaleFactor - zoomScaleFactor) < 0.05f) {
|
if (Math.abs(_scaleFactor - zoomScaleFactor) < 0.05f && Math.abs(_translationX) / width < 0.03f && Math.abs(_translationY) / height < 0.03f) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -395,8 +391,7 @@ class GestureControlView : LinearLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun willSnapFit(): Boolean {
|
private fun willSnapFit(): Boolean {
|
||||||
//TODO: Make sure pan is not too far away from 0, 0
|
return Math.abs(_scaleFactor - 1.0f) < 0.05f && Math.abs(_translationX) / width < 0.03f && Math.abs(_translationY) / height < 0.03f
|
||||||
return Math.abs(_scaleFactor - 1.0f) < 0.05f
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun cancelHideJob() {
|
fun cancelHideJob() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user