author | Scott Johnson <sjohnson@mozilla.com> |
Wed, 14 Nov 2012 15:58:12 -0800 | |
changeset 113314 | d3a58eacf6dfe4e939c78883871eaf0cd9704677 |
parent 113313 | 89346db799db81c25ccbb34ca0a33633c5b3b6f8 |
child 113315 | e9c9d1ff7a15dce5c271a4bd63c60a97dbd264af |
push id | 23869 |
push user | emorley@mozilla.com |
push date | Thu, 15 Nov 2012 16:18:16 +0000 |
treeherder | mozilla-central@a37525d304d9 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | kats |
bugs | 809565 |
milestone | 19.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
mobile/android/base/ui/SimpleScaleGestureDetector.java | file | annotate | diff | comparison | revisions |
--- a/mobile/android/base/ui/SimpleScaleGestureDetector.java +++ b/mobile/android/base/ui/SimpleScaleGestureDetector.java @@ -35,16 +35,17 @@ import java.util.Stack; * * - It doesn't take pressure into account, which results in smoother scaling. */ public class SimpleScaleGestureDetector { private static final String LOGTAG = "GeckoSimpleScaleGestureDetector"; private SimpleScaleGestureListener mListener; private long mLastEventTime; + private boolean mScaleResult; /* Information about all pointers that are down. */ private LinkedList<PointerInfo> mPointerInfo; /** Creates a new gesture detector with the given listener. */ public SimpleScaleGestureDetector(SimpleScaleGestureListener listener) { mListener = listener; mPointerInfo = new LinkedList<PointerInfo>(); @@ -201,19 +202,29 @@ public class SimpleScaleGestureDetector /** Returns true if the scale gesture is in progress and false otherwise. */ public boolean isInProgress() { return getPointersDown() == 2; } /* Sends the requested scale gesture notification to the listener. */ private void sendScaleGesture(EventType eventType) { switch (eventType) { - case BEGIN: mListener.onScaleBegin(this); break; - case CONTINUE: mListener.onScale(this); break; - case END: mListener.onScaleEnd(this); break; + case BEGIN: + mScaleResult = mListener.onScaleBegin(this); + break; + case CONTINUE: + if (mScaleResult) { + mListener.onScale(this); + } + break; + case END: + if (mScaleResult) { + mListener.onScaleEnd(this); + } + break; } } /* * Returns the pointer info corresponding to the given pointer index, or null if the pointer * isn't one that's being tracked. */ private PointerInfo pointerInfoForEventIndex(MotionEvent event, int index) {