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

Side by Side Diff: ui/events/gesture_detection/scale_gesture_detector.h

Issue 200623003: Adopt "QuickScale" double-tap drag zoom code in the GestureProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment Created 6 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef UI_EVENTS_GESTURE_DETECTION_SCALE_GESTURE_DETECTOR_H_ 5 #ifndef UI_EVENTS_GESTURE_DETECTION_SCALE_GESTURE_DETECTOR_H_
6 #define UI_EVENTS_GESTURE_DETECTION_SCALE_GESTURE_DETECTOR_H_ 6 #define UI_EVENTS_GESTURE_DETECTION_SCALE_GESTURE_DETECTOR_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "ui/events/gesture_detection/gesture_detection_export.h" 10 #include "ui/events/gesture_detection/gesture_detection_export.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // 64 //
65 // Returns true if the event was processed and the detector wants to receive 65 // Returns true if the event was processed and the detector wants to receive
66 // the rest of the MotionEvents in this event stream. 66 // the rest of the MotionEvents in this event stream.
67 bool OnTouchEvent(const MotionEvent& event); 67 bool OnTouchEvent(const MotionEvent& event);
68 68
69 // Set whether the associated |ScaleGestureListener| should receive 69 // Set whether the associated |ScaleGestureListener| should receive
70 // OnScale callbacks when the user performs a doubletap followed by a swipe. 70 // OnScale callbacks when the user performs a doubletap followed by a swipe.
71 void SetQuickScaleEnabled(bool scales); 71 void SetQuickScaleEnabled(bool scales);
72 bool IsQuickScaleEnabled() const; 72 bool IsQuickScaleEnabled() const;
73 bool IsInProgress() const; 73 bool IsInProgress() const;
74 bool InDoubleTapMode() const;
74 float GetFocusX() const; 75 float GetFocusX() const;
75 float GetFocusY() const; 76 float GetFocusY() const;
76 float GetCurrentSpan() const; 77 float GetCurrentSpan() const;
77 float GetCurrentSpanX() const; 78 float GetCurrentSpanX() const;
78 float GetCurrentSpanY() const; 79 float GetCurrentSpanY() const;
79 float GetPreviousSpan() const; 80 float GetPreviousSpan() const;
80 float GetPreviousSpanX() const; 81 float GetPreviousSpanX() const;
81 float GetPreviousSpanY() const; 82 float GetPreviousSpanY() const;
82 float GetScaleFactor() const; 83 float GetScaleFactor() const;
83 base::TimeDelta GetTimeDelta() const; 84 base::TimeDelta GetTimeDelta() const;
84 base::TimeTicks GetEventTime() const; 85 base::TimeTicks GetEventTime() const;
85 86
86 private: 87 private:
87 enum DoubleTapMode { DOUBLE_TAP_MODE_NONE, DOUBLE_TAP_MODE_IN_PROGRESS }; 88 enum DoubleTapMode { DOUBLE_TAP_MODE_NONE, DOUBLE_TAP_MODE_IN_PROGRESS };
88 89
89 // DoubleTapListener implementation. 90 // DoubleTapListener implementation.
90 virtual bool OnDoubleTap(const MotionEvent& ev) OVERRIDE; 91 virtual bool OnDoubleTap(const MotionEvent& ev) OVERRIDE;
91 92
92 // The TouchMajor/TouchMinor elements of a MotionEvent can flutter/jitter on 93 // The TouchMajor/TouchMinor elements of a MotionEvent can flutter/jitter on
93 // some hardware/driver combos. Smooth out to get kinder, gentler behavior. 94 // some hardware/driver combos. Smooth out to get kinder, gentler behavior.
94 void AddTouchHistory(const MotionEvent& ev); 95 void AddTouchHistory(const MotionEvent& ev);
95 void ClearTouchHistory(); 96 void ClearTouchHistory();
96 bool InDoubleTapMode() const;
97 97
98 ScaleGestureListener* const listener_; 98 ScaleGestureListener* const listener_;
99 99
100 Config config_; 100 Config config_;
101 101
102 float focus_x_; 102 float focus_x_;
103 float focus_y_; 103 float focus_y_;
104 104
105 bool quick_scale_enabled_; 105 bool quick_scale_enabled_;
106 106
(...skipping 24 matching lines...) Expand all
131 bool event_before_or_above_starting_gesture_event_; 131 bool event_before_or_above_starting_gesture_event_;
132 132
133 scoped_ptr<GestureDetector> gesture_detector_; 133 scoped_ptr<GestureDetector> gesture_detector_;
134 134
135 DISALLOW_COPY_AND_ASSIGN(ScaleGestureDetector); 135 DISALLOW_COPY_AND_ASSIGN(ScaleGestureDetector);
136 }; 136 };
137 137
138 } // namespace ui 138 } // namespace ui
139 139
140 #endif // UI_EVENTS_GESTURE_DETECTION_SCALE_GESTURE_DETECTOR_H_ 140 #endif // UI_EVENTS_GESTURE_DETECTION_SCALE_GESTURE_DETECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698