| 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_UI_GESTURE_INTERPRETER_H_ | 5 #ifndef REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_ |
| 6 #define REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_ | 6 #define REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "remoting/client/ui/desktop_viewport.h" | 10 #include "remoting/client/ui/desktop_viewport.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 void TwoFingerTap(float x, float y); | 42 void TwoFingerTap(float x, float y); |
| 43 | 43 |
| 44 // Caller is expected to call both Pan() and LongPress() when long-press is in | 44 // Caller is expected to call both Pan() and LongPress() when long-press is in |
| 45 // progress. | 45 // progress. |
| 46 void LongPress(float x, float y, GestureState state); | 46 void LongPress(float x, float y, GestureState state); |
| 47 | 47 |
| 48 // Called when the user has just done a one-finger pan (no long-press or | 48 // Called when the user has just done a one-finger pan (no long-press or |
| 49 // pinching) and the pan gesture still has some final velocity. | 49 // pinching) and the pan gesture still has some final velocity. |
| 50 void OneFingerFling(float velocity_x, float velocity_y); | 50 void OneFingerFling(float velocity_x, float velocity_y); |
| 51 | 51 |
| 52 // Called during a two-finger scroll (panning without pinching) gesture. |
| 53 void Scroll(float x, float y, float dx, float dy); |
| 54 |
| 55 // Called when the user has just done a scroll gesture and the scroll gesture |
| 56 // still has some final velocity. |
| 57 void ScrollWithVelocity(float velocity_x, float velocity_y); |
| 58 |
| 52 // Called to process one animation frame. | 59 // Called to process one animation frame. |
| 53 void ProcessAnimations(); | 60 void ProcessAnimations(); |
| 54 | 61 |
| 55 void OnSurfaceSizeChanged(int width, int height); | 62 void OnSurfaceSizeChanged(int width, int height); |
| 56 void OnDesktopSizeChanged(int width, int height); | 63 void OnDesktopSizeChanged(int width, int height); |
| 57 | 64 |
| 58 private: | 65 private: |
| 59 void PanWithoutAbortAnimations(float translation_x, float translation_y); | 66 void PanWithoutAbortAnimations(float translation_x, float translation_y); |
| 60 | 67 |
| 68 void ScrollWithoutAbortAnimations(float dx, float dy); |
| 69 |
| 61 void AbortAnimations(); | 70 void AbortAnimations(); |
| 62 | 71 |
| 63 void InjectMouseClick(float x, | 72 void InjectMouseClick(float x, |
| 64 float y, | 73 float y, |
| 65 protocol::MouseEvent_MouseButton button); | 74 protocol::MouseEvent_MouseButton button); |
| 66 | 75 |
| 67 // Tracks the touch point and gets back the cursor position from the input | 76 // Tracks the touch point and gets back the cursor position from the input |
| 68 // strategy. | 77 // strategy. |
| 69 ViewMatrix::Point TrackAndGetPosition(float touch_x, float touch_y); | 78 ViewMatrix::Point TrackAndGetPosition(float touch_x, float touch_y); |
| 70 | 79 |
| 71 // If the cursor is visible, send the cursor position from the input strategy | 80 // If the cursor is visible, send the cursor position from the input strategy |
| 72 // to the renderer. | 81 // to the renderer. |
| 73 void SetCursorPositionOnRenderer(); | 82 void SetCursorPositionOnRenderer(); |
| 74 | 83 |
| 75 // Starts the given feedback at (cursor_x, cursor_y) if the feedback radius | 84 // Starts the given feedback at (cursor_x, cursor_y) if the feedback radius |
| 76 // is non-zero. | 85 // is non-zero. |
| 77 void StartInputFeedback(float cursor_x, | 86 void StartInputFeedback(float cursor_x, |
| 78 float cursor_y, | 87 float cursor_y, |
| 79 InputStrategy::InputFeedbackType feedback_type); | 88 InputStrategy::InputFeedbackType feedback_type); |
| 80 | 89 |
| 81 std::unique_ptr<InputStrategy> input_strategy_; | 90 std::unique_ptr<InputStrategy> input_strategy_; |
| 82 DesktopViewport viewport_; | 91 DesktopViewport viewport_; |
| 83 RendererProxy* renderer_; | 92 RendererProxy* renderer_; |
| 84 ChromotingSession* input_stub_; | 93 ChromotingSession* input_stub_; |
| 85 bool is_dragging_mode_ = false; | 94 bool is_dragging_mode_ = false; |
| 86 | 95 |
| 87 FlingAnimation pan_animation_; | 96 FlingAnimation pan_animation_; |
| 97 FlingAnimation scroll_animation_; |
| 88 | 98 |
| 89 // GestureInterpreter is neither copyable nor movable. | 99 // GestureInterpreter is neither copyable nor movable. |
| 90 GestureInterpreter(const GestureInterpreter&) = delete; | 100 GestureInterpreter(const GestureInterpreter&) = delete; |
| 91 GestureInterpreter& operator=(const GestureInterpreter&) = delete; | 101 GestureInterpreter& operator=(const GestureInterpreter&) = delete; |
| 92 }; | 102 }; |
| 93 | 103 |
| 94 } // namespace remoting | 104 } // namespace remoting |
| 95 #endif // REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_ | 105 #endif // REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_ |
| OLD | NEW |