@@ -122,7 +122,6 @@ class R2WebView(context: Context, attrs: AttributeSet) : R2BasicWebView(context,
122122 * Position of the last motion event.
123123 */
124124 private var mLastMotionX: Float = 0 .toFloat()
125- private var mLastMotionY: Float = 0 .toFloat()
126125 private var mInitialMotionX: Float = 0 .toFloat()
127126 private var mInitialMotionY: Float = 0 .toFloat()
128127
@@ -685,7 +684,6 @@ class R2WebView(context: Context, attrs: AttributeSet) : R2BasicWebView(context,
685684 mInitialMotionX = ev.x
686685 mLastMotionX = mInitialMotionX
687686 mInitialMotionY = ev.y
688- mLastMotionY = mInitialMotionY
689687 mActivePointerId = ev.getPointerId(0 )
690688 }
691689 MotionEvent .ACTION_MOVE -> {
@@ -700,18 +698,15 @@ class R2WebView(context: Context, attrs: AttributeSet) : R2BasicWebView(context,
700698 val pointerIndex = ev.findPointerIndex(mActivePointerId)
701699 val x = ev.getX(pointerIndex)
702700 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 " )
706702
707- if (xDiff > mTouchSlop && xDiff > yDiff ) {
703+ if (xDiff > mTouchSlop) {
708704 if (DEBUG ) Timber .v(" Starting drag!" )
709705 mIsBeingDragged = true
710706 mLastMotionX = if (x - mInitialMotionX > 0 )
711707 mInitialMotionX + mTouchSlop
712708 else
713709 mInitialMotionX - mTouchSlop
714- mLastMotionY = y
715710 setScrollState(SCROLL_STATE_DRAGGING )
716711 setScrollingCacheEnabled(true )
717712 }
0 commit comments