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

Side by Side Diff: remoting/client/ui/direct_input_strategy.cc

Issue 2897143002: [CRD iOS] Ignore touch event when the touch point is out of the canvas in direct input mode (Closed)
Patch Set: 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
« no previous file with comments | « remoting/client/ui/direct_input_strategy.h ('k') | remoting/client/ui/gesture_interpreter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "remoting/client/ui/direct_input_strategy.h" 5 #include "remoting/client/ui/direct_input_strategy.h"
6 #include "remoting/client/ui/desktop_viewport.h" 6 #include "remoting/client/ui/desktop_viewport.h"
7 7
8 namespace remoting { 8 namespace remoting {
9 9
10 namespace { 10 namespace {
(...skipping 23 matching lines...) Expand all
34 ViewMatrix::Vector2D viewport_movement = 34 ViewMatrix::Vector2D viewport_movement =
35 viewport->GetTransformation().Invert().MapVector(translation); 35 viewport->GetTransformation().Invert().MapVector(translation);
36 viewport->MoveViewport(viewport_movement.x, viewport_movement.y); 36 viewport->MoveViewport(viewport_movement.x, viewport_movement.y);
37 return false; 37 return false;
38 } 38 }
39 39
40 viewport->MoveDesktop(translation.x, translation.y); 40 viewport->MoveDesktop(translation.x, translation.y);
41 return false; 41 return false;
42 } 42 }
43 43
44 void DirectInputStrategy::TrackTouchInput(const ViewMatrix::Point& touch_point, 44 bool DirectInputStrategy::TrackTouchInput(const ViewMatrix::Point& touch_point,
45 const DesktopViewport& viewport) { 45 const DesktopViewport& viewport) {
46 cursor_position_ = 46 ViewMatrix::Point new_position =
47 viewport.GetTransformation().Invert().MapPoint(touch_point); 47 viewport.GetTransformation().Invert().MapPoint(touch_point);
48 if (!viewport.IsPointWithinDesktopBounds(new_position)) {
49 return false;
50 }
51 cursor_position_ = new_position;
52 return true;
48 } 53 }
49 54
50 ViewMatrix::Point DirectInputStrategy::GetCursorPosition() const { 55 ViewMatrix::Point DirectInputStrategy::GetCursorPosition() const {
51 return cursor_position_; 56 return cursor_position_;
52 } 57 }
53 58
54 ViewMatrix::Vector2D DirectInputStrategy::MapScreenVectorToDesktop( 59 ViewMatrix::Vector2D DirectInputStrategy::MapScreenVectorToDesktop(
55 const ViewMatrix::Vector2D& delta, 60 const ViewMatrix::Vector2D& delta,
56 const DesktopViewport& viewport) const { 61 const DesktopViewport& viewport) const {
57 return viewport.GetTransformation().Invert().MapVector(delta); 62 return viewport.GetTransformation().Invert().MapVector(delta);
58 } 63 }
59 64
60 float DirectInputStrategy::GetFeedbackRadius(InputFeedbackType type) const { 65 float DirectInputStrategy::GetFeedbackRadius(InputFeedbackType type) const {
61 switch (type) { 66 switch (type) {
62 case InputFeedbackType::TAP_FEEDBACK: 67 case InputFeedbackType::TAP_FEEDBACK:
63 return kTapFeedbackRadius; 68 return kTapFeedbackRadius;
64 case InputFeedbackType::DRAG_FEEDBACK: 69 case InputFeedbackType::DRAG_FEEDBACK:
65 return kDragFeedbackRadius; 70 return kDragFeedbackRadius;
66 } 71 }
67 NOTREACHED(); 72 NOTREACHED();
68 return 0.f; 73 return 0.f;
69 } 74 }
70 75
71 bool DirectInputStrategy::IsCursorVisible() const { 76 bool DirectInputStrategy::IsCursorVisible() const {
72 return false; 77 return false;
73 } 78 }
74 79
75 } // namespace remoting 80 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/ui/direct_input_strategy.h ('k') | remoting/client/ui/gesture_interpreter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698