Chromium Code Reviews| 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 void Scroll(float x, float y, float dx, float dy); | |
| 53 | |
| 54 void ScrollFling(float velocity_x, float velocity_y); | |
|
nicholss
2017/05/16 18:13:10
Fling does not mean a ton, perhaps just ScollWithV
Yuwei
2017/05/17 05:42:20
Done.
| |
| 55 | |
| 52 // Called to process one animation frame. | 56 // Called to process one animation frame. |
| 53 void ProcessAnimations(); | 57 void ProcessAnimations(); |
| 54 | 58 |
| 55 void OnSurfaceSizeChanged(int width, int height); | 59 void OnSurfaceSizeChanged(int width, int height); |
| 56 void OnDesktopSizeChanged(int width, int height); | 60 void OnDesktopSizeChanged(int width, int height); |
| 57 | 61 |
| 58 private: | 62 private: |
| 59 void PanWithoutAbortAnimations(float translation_x, float translation_y); | 63 void PanWithoutAbortAnimations(float translation_x, float translation_y); |
| 60 | 64 |
| 65 void ScrollWithoutAbortAnimations(float dx, float dy); | |
| 66 | |
| 61 void AbortAnimations(); | 67 void AbortAnimations(); |
| 62 | 68 |
| 63 void InjectMouseClick(float x, | 69 void InjectMouseClick(float x, |
| 64 float y, | 70 float y, |
| 65 protocol::MouseEvent_MouseButton button); | 71 protocol::MouseEvent_MouseButton button); |
| 66 | 72 |
| 67 // Tracks the touch point and gets back the cursor position from the input | 73 // Tracks the touch point and gets back the cursor position from the input |
| 68 // strategy. | 74 // strategy. |
| 69 ViewMatrix::Point TrackAndGetPosition(float touch_x, float touch_y); | 75 ViewMatrix::Point TrackAndGetPosition(float touch_x, float touch_y); |
| 70 | 76 |
| 71 // If the cursor is visible, send the cursor position from the input strategy | 77 // If the cursor is visible, send the cursor position from the input strategy |
| 72 // to the renderer. | 78 // to the renderer. |
| 73 void SetCursorPositionOnRenderer(); | 79 void SetCursorPositionOnRenderer(); |
| 74 | 80 |
| 75 // Starts the given feedback at (cursor_x, cursor_y) if the feedback radius | 81 // Starts the given feedback at (cursor_x, cursor_y) if the feedback radius |
| 76 // is non-zero. | 82 // is non-zero. |
| 77 void StartInputFeedback(float cursor_x, | 83 void StartInputFeedback(float cursor_x, |
| 78 float cursor_y, | 84 float cursor_y, |
| 79 InputStrategy::InputFeedbackType feedback_type); | 85 InputStrategy::InputFeedbackType feedback_type); |
| 80 | 86 |
| 81 std::unique_ptr<InputStrategy> input_strategy_; | 87 std::unique_ptr<InputStrategy> input_strategy_; |
| 82 DesktopViewport viewport_; | 88 DesktopViewport viewport_; |
| 83 RendererProxy* renderer_; | 89 RendererProxy* renderer_; |
| 84 ChromotingSession* input_stub_; | 90 ChromotingSession* input_stub_; |
| 85 bool is_dragging_mode_ = false; | 91 bool is_dragging_mode_ = false; |
| 86 | 92 |
| 87 FlingAnimation pan_animation_; | 93 FlingAnimation pan_animation_; |
| 94 FlingAnimation scroll_animation_; | |
| 88 | 95 |
| 89 // GestureInterpreter is neither copyable nor movable. | 96 // GestureInterpreter is neither copyable nor movable. |
| 90 GestureInterpreter(const GestureInterpreter&) = delete; | 97 GestureInterpreter(const GestureInterpreter&) = delete; |
| 91 GestureInterpreter& operator=(const GestureInterpreter&) = delete; | 98 GestureInterpreter& operator=(const GestureInterpreter&) = delete; |
| 92 }; | 99 }; |
| 93 | 100 |
| 94 } // namespace remoting | 101 } // namespace remoting |
| 95 #endif // REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_ | 102 #endif // REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_ |
| OLD | NEW |