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

Side by Side Diff: remoting/client/gesture_interpreter.h

Issue 2869723007: [CRD iOS] Viewport fling animation (Closed)
Patch Set: Merge branch 'master' into feat-fling-animation Created 3 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 unified diff | Download patch
OLDNEW
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/chromoting_session.h" 10 #include "remoting/client/chromoting_session.h"
11 #include "remoting/client/desktop_viewport.h" 11 #include "remoting/client/desktop_viewport.h"
12 #include "remoting/client/fling_animation.h"
12 #include "remoting/proto/event.pb.h" 13 #include "remoting/proto/event.pb.h"
13 14
14 namespace remoting { 15 namespace remoting {
15 16
16 class InputStrategy; 17 class InputStrategy;
17 18
18 // This is a class for interpreting a raw touch input into actions like moving 19 // This is a class for interpreting a raw touch input into actions like moving
19 // the viewport and injecting mouse clicks. 20 // the viewport and injecting mouse clicks.
20 class GestureInterpreter { 21 class GestureInterpreter {
21 public: 22 public:
22 enum GestureState { GESTURE_BEGAN, GESTURE_CHANGED, GESTURE_ENDED }; 23 enum GestureState { GESTURE_BEGAN, GESTURE_CHANGED, GESTURE_ENDED };
23 24
24 GestureInterpreter( 25 GestureInterpreter(
25 const DesktopViewport::TransformationCallback& on_transformation_changed, 26 const DesktopViewport::TransformationCallback& on_transformation_changed,
26 ChromotingSession* input_stub); 27 ChromotingSession* input_stub);
27 ~GestureInterpreter(); 28 ~GestureInterpreter();
28 29
29 // Coordinates of the OpenGL view surface will be used. 30 // Coordinates of the OpenGL view surface will be used.
30 void Pinch(float pivot_x, float pivot_y, float scale); 31 void Pinch(float pivot_x, float pivot_y, float scale);
31 void Pan(float translation_x, float translation_y); 32 void Pan(float translation_x, float translation_y);
32 void Tap(float x, float y); 33 void Tap(float x, float y);
33 void TwoFingerTap(float x, float y); 34 void TwoFingerTap(float x, float y);
34 35
35 // Caller is expected to call both Pan() and LongPress() when long-press is in 36 // Caller is expected to call both Pan() and LongPress() when long-press is in
36 // progress. 37 // progress.
37 void LongPress(float x, float y, GestureState state); 38 void LongPress(float x, float y, GestureState state);
38 39
40 void OneFingerFling(float velocity_x, float velocity_y);
41
42 // Called to process one animation frame.
43 void ProcessAnimations();
44
39 void OnSurfaceSizeChanged(int width, int height); 45 void OnSurfaceSizeChanged(int width, int height);
40 void OnDesktopSizeChanged(int width, int height); 46 void OnDesktopSizeChanged(int width, int height);
41 47
42 private: 48 private:
49 void PanWithoutAbortAnimations(float translation_x, float translation_y);
50
51 void AbortAnimations();
52
43 void InjectMouseClick(float x, 53 void InjectMouseClick(float x,
44 float y, 54 float y,
45 protocol::MouseEvent_MouseButton button); 55 protocol::MouseEvent_MouseButton button);
46 56
47 std::unique_ptr<InputStrategy> input_strategy_; 57 std::unique_ptr<InputStrategy> input_strategy_;
48 DesktopViewport viewport_; 58 DesktopViewport viewport_;
49 ChromotingSession* input_stub_; 59 ChromotingSession* input_stub_;
50 bool is_dragging_mode_ = false; 60 bool is_dragging_mode_ = false;
51 61
62 FlingAnimation pan_animation_;
63
52 // GestureInterpreter is neither copyable nor movable. 64 // GestureInterpreter is neither copyable nor movable.
53 GestureInterpreter(const GestureInterpreter&) = delete; 65 GestureInterpreter(const GestureInterpreter&) = delete;
54 GestureInterpreter& operator=(const GestureInterpreter&) = delete; 66 GestureInterpreter& operator=(const GestureInterpreter&) = delete;
55 }; 67 };
56 68
57 } // namespace remoting 69 } // namespace remoting
58 #endif // REMOTING_CLIENT_GESTURE_INTERPRETER_H_ 70 #endif // REMOTING_CLIENT_GESTURE_INTERPRETER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698