mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Made snapping only work when panned close to center.
This commit is contained in:
parent
2c7f02a24d
commit
b9c7e0a8ca
1 changed files with 2 additions and 7 deletions
|
@ -9,7 +9,6 @@ import android.graphics.Matrix
|
|||
import android.graphics.drawable.Animatable
|
||||
import android.media.AudioManager
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.GestureDetector
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
|
@ -291,8 +290,6 @@ class GestureControlView : LinearLayout {
|
|||
_translationY = translationY.coerceAtLeast(ymin).coerceAtMost(ymax)
|
||||
|
||||
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) {
|
||||
|
@ -382,11 +379,10 @@ class GestureControlView : LinearLayout {
|
|||
}
|
||||
|
||||
private fun willSnapFill(): Boolean {
|
||||
//TODO: Make sure pan is not too far away from 0, 0
|
||||
val surfaceView = _surfaceView
|
||||
if (surfaceView != null) {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -395,8 +391,7 @@ class GestureControlView : LinearLayout {
|
|||
}
|
||||
|
||||
private fun willSnapFit(): Boolean {
|
||||
//TODO: Make sure pan is not too far away from 0, 0
|
||||
return Math.abs(_scaleFactor - 1.0f) < 0.05f
|
||||
return Math.abs(_scaleFactor - 1.0f) < 0.05f && Math.abs(_translationX) / width < 0.03f && Math.abs(_translationY) / height < 0.03f
|
||||
}
|
||||
|
||||
fun cancelHideJob() {
|
||||
|
|
Loading…
Add table
Reference in a new issue