Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Unified Diff: ui/events/gesture_detection/gesture_provider.cc

Issue 298823006: [Aura] Reduce frequency of PinchUpdate events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Jared's comments. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 7607f08d8765a7fbc02a96f7eb471af5f813efcb..55bc37010402aad0021a62760f0a07d5d378ca89 100644
--- a/ui/events/gesture_detection/gesture_provider.cc
+++ b/ui/events/gesture_detection/gesture_provider.cc
@@ -130,7 +130,8 @@ class GestureProvider::ScaleGestureListenerImpl
: scale_gesture_detector_(config, this),
provider_(provider),
ignore_multitouch_events_(false),
- pinch_event_sent_(false) {}
+ pinch_event_sent_(false),
+ min_pinch_update_span_delta_(config.min_pinch_update_span_delta) {}
bool OnTouchEvent(const MotionEvent& event) {
// TODO: Need to deal with multi-touch transition.
@@ -182,6 +183,11 @@ class GestureProvider::ScaleGestureListenerImpl
GetBoundingBox(e)));
}
+ if (std::abs(detector.GetCurrentSpan() - detector.GetPreviousSpan()) <
+ min_pinch_update_span_delta_) {
+ return false;
+ }
+
float scale = detector.GetScaleFactor();
if (scale == 1)
return true;
@@ -247,6 +253,10 @@ class GestureProvider::ScaleGestureListenerImpl
// Whether any pinch zoom event has been sent to native.
bool pinch_event_sent_;
+ // The minimum change in span required before this is considered a pinch. See
+ // crbug.com/373318.
+ float min_pinch_update_span_delta_;
+
DISALLOW_COPY_AND_ASSIGN(ScaleGestureListenerImpl);
};
« no previous file with comments | « ui/events/gesture_detection/gesture_config_helper_aura.cc ('k') | ui/events/gesture_detection/gesture_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698