@@ -122,7 +122,6 @@ class R2WebView(context: Context, attrs: AttributeSet) : R2BasicWebView(context,
122
122
* Position of the last motion event.
123
123
*/
124
124
private var mLastMotionX: Float = 0 .toFloat()
125
- private var mLastMotionY: Float = 0 .toFloat()
126
125
private var mInitialMotionX: Float = 0 .toFloat()
127
126
private var mInitialMotionY: Float = 0 .toFloat()
128
127
@@ -685,7 +684,6 @@ class R2WebView(context: Context, attrs: AttributeSet) : R2BasicWebView(context,
685
684
mInitialMotionX = ev.x
686
685
mLastMotionX = mInitialMotionX
687
686
mInitialMotionY = ev.y
688
- mLastMotionY = mInitialMotionY
689
687
mActivePointerId = ev.getPointerId(0 )
690
688
}
691
689
MotionEvent .ACTION_MOVE -> {
@@ -700,18 +698,15 @@ class R2WebView(context: Context, attrs: AttributeSet) : R2BasicWebView(context,
700
698
val pointerIndex = ev.findPointerIndex(mActivePointerId)
701
699
val x = ev.getX(pointerIndex)
702
700
val xDiff = abs(x - mLastMotionX)
703
- val y = ev.getY(pointerIndex)
704
- val yDiff = abs(y - mLastMotionY)
705
- if (DEBUG ) Timber .v(" Moved x to $x ,$y diff=$xDiff ,$yDiff " )
701
+ if (DEBUG ) Timber .v(" Moved x to $x diff=$xDiff " )
706
702
707
- if (xDiff > mTouchSlop && xDiff > yDiff ) {
703
+ if (xDiff > mTouchSlop) {
708
704
if (DEBUG ) Timber .v(" Starting drag!" )
709
705
mIsBeingDragged = true
710
706
mLastMotionX = if (x - mInitialMotionX > 0 )
711
707
mInitialMotionX + mTouchSlop
712
708
else
713
709
mInitialMotionX - mTouchSlop
714
- mLastMotionY = y
715
710
setScrollState(SCROLL_STATE_DRAGGING )
716
711
setScrollingCacheEnabled(true )
717
712
}
0 commit comments