Index: ui/events/gesture_detection/scale_gesture_detector.cc |
diff --git a/ui/events/gesture_detection/scale_gesture_detector.cc b/ui/events/gesture_detection/scale_gesture_detector.cc |
index f9e091bc6ce55204704cf144593c114f7050ca51..5ac30d3e6f89fa50e200aad94c326d5970cd6dfd 100644 |
--- a/ui/events/gesture_detection/scale_gesture_detector.cc |
+++ b/ui/events/gesture_detection/scale_gesture_detector.cc |
@@ -33,7 +33,8 @@ const float kScaleFactor = .5f; |
ScaleGestureDetector::Config::Config() |
: min_scaling_touch_major(48), |
min_scaling_span(200), |
- quick_scale_enabled(true) {} |
+ quick_scale_enabled(true), |
+ min_pinch_update_distance(0) {} |
ScaleGestureDetector::Config::~Config() {} |
@@ -80,6 +81,7 @@ ScaleGestureDetector::ScaleGestureDetector(const Config& config, |
span_slop_ = |
(config.gesture_detector_config.touch_slop + kSlopEpsilon) * 2; |
touch_min_major_ = config.min_scaling_touch_major; |
+ min_pinch_update_distance_ = config.min_pinch_update_distance; |
min_span_ = config.min_scaling_span + kSlopEpsilon; |
SetQuickScaleEnabled(config.quick_scale_enabled); |
} |
@@ -205,6 +207,9 @@ bool ScaleGestureDetector::OnTouchEvent(const MotionEvent& event) { |
initial_span_ = prev_span_ = curr_span_ = span; |
} |
+ bool pinch_occured = |
+ std::abs(span - prev_span_) >= min_pinch_update_distance_; |
jdduke (slow)
2014/05/21 19:30:37
Can we move this check into the ACTION_MOVE portio
tdresser
2014/05/22 12:31:44
We need to read prev_span_ before it is modified b
|
+ |
const float min_span = InDoubleTapMode() ? span_slop_ : min_span_; |
if (!in_progress_ && span >= min_span && |
(was_in_progress || std::abs(span - initial_span_) > span_slop_)) { |
@@ -217,6 +222,9 @@ bool ScaleGestureDetector::OnTouchEvent(const MotionEvent& event) { |
// Handle motion; focal point and span/scale factor are changing. |
if (action == MotionEvent::ACTION_MOVE) { |
+ if (!pinch_occured) |
+ return true; |
+ |
curr_span_x_ = span_x; |
curr_span_y_ = span_y; |
curr_span_ = span; |