| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 REMOTING_CLIENT_GESTURE_INTERPRETER_H_ | 5 #ifndef REMOTING_CLIENT_GESTURE_INTERPRETER_H_ |
| 6 #define REMOTING_CLIENT_GESTURE_INTERPRETER_H_ | 6 #define REMOTING_CLIENT_GESTURE_INTERPRETER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "remoting/client/input/input_strategy.h" | 10 #include "remoting/client/input/input_strategy.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Called whenever the user did a pan gesture. It can be one-finger pan, no | 47 // Called whenever the user did a pan gesture. It can be one-finger pan, no |
| 48 // matter dragging in on or not, or two-finger pan in conjunction with zoom. | 48 // matter dragging in on or not, or two-finger pan in conjunction with zoom. |
| 49 // Two-finger pan without zoom is consider a scroll gesture. | 49 // Two-finger pan without zoom is consider a scroll gesture. |
| 50 void Pan(float translation_x, float translation_y); | 50 void Pan(float translation_x, float translation_y); |
| 51 | 51 |
| 52 // Called when the user did a one-finger tap. | 52 // Called when the user did a one-finger tap. |
| 53 void Tap(float x, float y); | 53 void Tap(float x, float y); |
| 54 | 54 |
| 55 void TwoFingerTap(float x, float y); | 55 void TwoFingerTap(float x, float y); |
| 56 | 56 |
| 57 void ThreeFingerTap(float x, float y); |
| 58 |
| 57 // Caller is expected to call both Pan() and Drag() when dragging is in | 59 // Caller is expected to call both Pan() and Drag() when dragging is in |
| 58 // progress. | 60 // progress. |
| 59 void Drag(float x, float y, GestureState state); | 61 void Drag(float x, float y, GestureState state); |
| 60 | 62 |
| 61 // Called when the user has just done a one-finger pan (no dragging or | 63 // Called when the user has just done a one-finger pan (no dragging or |
| 62 // zooming) and the pan gesture still has some final velocity. | 64 // zooming) and the pan gesture still has some final velocity. |
| 63 void OneFingerFling(float velocity_x, float velocity_y); | 65 void OneFingerFling(float velocity_x, float velocity_y); |
| 64 | 66 |
| 65 // Called during a two-finger scroll (panning without zooming) gesture. | 67 // Called during a two-finger scroll (panning without zooming) gesture. |
| 66 void Scroll(float x, float y, float dx, float dy); | 68 void Scroll(float x, float y, float dx, float dy); |
| 67 | 69 |
| 68 // Called when the user has just done a scroll gesture and the scroll gesture | 70 // Called when the user has just done a scroll gesture and the scroll gesture |
| 69 // still has some final velocity. | 71 // still has some final velocity. |
| 70 void ScrollWithVelocity(float velocity_x, float velocity_y); | 72 void ScrollWithVelocity(float velocity_x, float velocity_y); |
| 71 | 73 |
| 72 // Called to process one animation frame. | 74 // Called to process one animation frame. |
| 73 void ProcessAnimations(); | 75 void ProcessAnimations(); |
| 74 | 76 |
| 75 void OnSurfaceSizeChanged(int width, int height); | 77 void OnSurfaceSizeChanged(int width, int height); |
| 76 void OnDesktopSizeChanged(int width, int height); | 78 void OnDesktopSizeChanged(int width, int height); |
| 77 | 79 |
| 78 private: | 80 private: |
| 79 void PanWithoutAbortAnimations(float translation_x, float translation_y); | 81 void PanWithoutAbortAnimations(float translation_x, float translation_y); |
| 80 | 82 |
| 81 void ScrollWithoutAbortAnimations(float dx, float dy); | 83 void ScrollWithoutAbortAnimations(float dx, float dy); |
| 82 | 84 |
| 83 void AbortAnimations(); | 85 void AbortAnimations(); |
| 84 | 86 |
| 85 void InjectMouseClick(float x, | 87 // Injects the mouse click event and shows the touch feedback. |
| 86 float y, | 88 void InjectMouseClick(float touch_x, |
| 89 float touch_y, |
| 87 protocol::MouseEvent_MouseButton button); | 90 protocol::MouseEvent_MouseButton button); |
| 88 | 91 |
| 89 void InjectCursorPosition(float x, float y); | 92 void InjectCursorPosition(float x, float y); |
| 90 | 93 |
| 91 void SetGestureInProgress(InputStrategy::Gesture gesture, | 94 void SetGestureInProgress(InputStrategy::Gesture gesture, |
| 92 bool is_in_progress); | 95 bool is_in_progress); |
| 93 | 96 |
| 94 // Starts the given feedback at (cursor_x, cursor_y) if the feedback radius | 97 // Starts the given feedback at (cursor_x, cursor_y) if the feedback radius |
| 95 // is non-zero. | 98 // is non-zero. |
| 96 void StartInputFeedback(float cursor_x, | 99 void StartInputFeedback(float cursor_x, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 FlingAnimation pan_animation_; | 110 FlingAnimation pan_animation_; |
| 108 FlingAnimation scroll_animation_; | 111 FlingAnimation scroll_animation_; |
| 109 | 112 |
| 110 // GestureInterpreter is neither copyable nor movable. | 113 // GestureInterpreter is neither copyable nor movable. |
| 111 GestureInterpreter(const GestureInterpreter&) = delete; | 114 GestureInterpreter(const GestureInterpreter&) = delete; |
| 112 GestureInterpreter& operator=(const GestureInterpreter&) = delete; | 115 GestureInterpreter& operator=(const GestureInterpreter&) = delete; |
| 113 }; | 116 }; |
| 114 | 117 |
| 115 } // namespace remoting | 118 } // namespace remoting |
| 116 #endif // REMOTING_CLIENT_GESTURE_INTERPRETER_H_ | 119 #endif // REMOTING_CLIENT_GESTURE_INTERPRETER_H_ |
| OLD | NEW |