OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.os.Bundle; | 8 import android.os.Bundle; |
9 import android.os.Handler; | 9 import android.os.Handler; |
10 import android.os.SystemClock; | 10 import android.os.SystemClock; |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 } else if (mDoubleTapDragMode == DOUBLE_TAP_DRAG
_MODE_ZOOM) { | 577 } else if (mDoubleTapDragMode == DOUBLE_TAP_DRAG
_MODE_ZOOM) { |
578 assert mExtraParamBundleDoubleTapDragZoom.is
Empty(); | 578 assert mExtraParamBundleDoubleTapDragZoom.is
Empty(); |
579 sendGesture(GESTURE_SCROLL_BY, e.getEventTim
e(), | 579 sendGesture(GESTURE_SCROLL_BY, e.getEventTim
e(), |
580 (int) e.getX(), (int) e.getY(), | 580 (int) e.getX(), (int) e.getY(), |
581 mExtraParamBundleDoubleTapDragZoom); | 581 mExtraParamBundleDoubleTapDragZoom); |
582 | 582 |
583 float dy = mDoubleTapY - e.getY(); | 583 float dy = mDoubleTapY - e.getY(); |
584 pinchBy(e.getEventTime(), | 584 pinchBy(e.getEventTime(), |
585 Math.round(mDoubleTapDragZoomAnchorX
), | 585 Math.round(mDoubleTapDragZoomAnchorX
), |
586 Math.round(mDoubleTapDragZoomAnchorY
), | 586 Math.round(mDoubleTapDragZoomAnchorY
), |
587 (float) Math.pow(dy < 0 ? | 587 (float) Math.pow(dy > 0 ? |
588 1.0f - DOUBLE_TAP_DRAG_ZOOM_
SPEED : | 588 1.0f - DOUBLE_TAP_DRAG_ZOOM_
SPEED : |
589 1.0f + DOUBLE_TAP_DRAG_ZOOM_
SPEED, | 589 1.0f + DOUBLE_TAP_DRAG_ZOOM_
SPEED, |
590 Math.abs(dy * mPxToDp))); | 590 Math.abs(dy * mPxToDp))); |
591 } | 591 } |
592 break; | 592 break; |
593 case MotionEvent.ACTION_UP: | 593 case MotionEvent.ACTION_UP: |
594 if (mDoubleTapDragMode != DOUBLE_TAP_DRAG_MODE_Z
OOM) { | 594 if (mDoubleTapDragMode != DOUBLE_TAP_DRAG_MODE_Z
OOM) { |
595 // Normal double tap gesture. | 595 // Normal double tap gesture. |
596 sendMotionEventAsGesture(GESTURE_DOUBLE_TAP,
e, null); | 596 sendMotionEventAsGesture(GESTURE_DOUBLE_TAP,
e, null); |
597 } | 597 } |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 assert (mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_DISABLED || | 1253 assert (mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_DISABLED || |
1254 mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_NONE); | 1254 mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_NONE); |
1255 mDoubleTapDragMode = supportDoubleTapDrag ? | 1255 mDoubleTapDragMode = supportDoubleTapDrag ? |
1256 DOUBLE_TAP_DRAG_MODE_NONE : DOUBLE_TAP_DRAG_MODE_DISABLED; | 1256 DOUBLE_TAP_DRAG_MODE_NONE : DOUBLE_TAP_DRAG_MODE_DISABLED; |
1257 } | 1257 } |
1258 | 1258 |
1259 private boolean isDoubleTapDragDisabled() { | 1259 private boolean isDoubleTapDragDisabled() { |
1260 return mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_DISABLED; | 1260 return mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_DISABLED; |
1261 } | 1261 } |
1262 } | 1262 } |
OLD | NEW |