Chromium Code Reviews| Index: ui/events/gesture_detection/gesture_provider.cc |
| diff --git a/ui/events/gesture_detection/gesture_provider.cc b/ui/events/gesture_detection/gesture_provider.cc |
| index c1d3163cfd6f6d14728b5289daa3d805e2e9b2c4..3a2e1add71f91b7bcc0efd32df122c0abe765bd4 100644 |
| --- a/ui/events/gesture_detection/gesture_provider.cc |
| +++ b/ui/events/gesture_detection/gesture_provider.cc |
| @@ -118,7 +118,6 @@ class GestureProvider::GestureListenerImpl : public ScaleGestureListener, |
| tap_down_point_ = gfx::PointF(event.GetX(), event.GetY()); |
| max_diameter_before_show_press_ = event.GetTouchMajor(); |
| } |
| - |
| gesture_detector_.OnTouchEvent(event); |
| scale_gesture_detector_.OnTouchEvent(event); |
| @@ -288,18 +287,17 @@ class GestureProvider::GestureListenerImpl : public ScaleGestureListener, |
| float raw_distance_y) override { |
| float distance_x = raw_distance_x; |
| float distance_y = raw_distance_y; |
| - if (!scroll_event_sent_ && e2.GetPointerCount() == 1) { |
| - // Remove the touch slop region from the first scroll event to |
| - // avoid a jump. Touch slop isn't used for multi-finger |
| - // gestures, so in those cases we don't subtract the slop. |
| + if (!scroll_event_sent_ && e2.GetPointerCount() < 3) { |
| + // Remove the touch slop region from the first scroll event to avoid a |
| + // jump. Touch slop isn't used for scroll gestures with greater than 2 |
| + // pointers down, in those cases we don't subtract the slop. |
| float distance = |
| std::sqrt(distance_x * distance_x + distance_y * distance_y); |
| float epsilon = 1e-3f; |
| if (distance > epsilon) { |
| - float ratio = |
| - std::max(0.f, |
| - distance - config_.gesture_detector_config.touch_slop) / |
| - distance; |
| + float subtraction_value = config_.gesture_detector_config.touch_slop / |
| + e2.GetPointerCount(); |
| + float ratio = std::max(0.f, distance - subtraction_value ) / distance; |
|
tdresser
2016/06/10 19:34:57
Is this logic correct? If the two pointers move in
sahel
2016/06/23 22:34:44
Done.
|
| distance_x *= ratio; |
| distance_y *= ratio; |
| } |