| 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 #include "remoting/client/ui/trackpad_input_strategy.h" | 5 #include "remoting/client/ui/trackpad_input_strategy.h" |
| 6 | 6 |
| 7 #include "remoting/client/ui/desktop_viewport.h" | 7 #include "remoting/client/ui/desktop_viewport.h" |
| 8 | 8 |
| 9 namespace remoting { | 9 namespace remoting { |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 cursor_position_.x += translation_on_desktop.x; | 47 cursor_position_.x += translation_on_desktop.x; |
| 48 cursor_position_.y += translation_on_desktop.y; | 48 cursor_position_.y += translation_on_desktop.y; |
| 49 | 49 |
| 50 cursor_position_ = viewport->ConstrainPointToDesktop(cursor_position_); | 50 cursor_position_ = viewport->ConstrainPointToDesktop(cursor_position_); |
| 51 | 51 |
| 52 // Keep the cursor on focus. | 52 // Keep the cursor on focus. |
| 53 viewport->SetViewportCenter(cursor_position_.x, cursor_position_.y); | 53 viewport->SetViewportCenter(cursor_position_.x, cursor_position_.y); |
| 54 return true; | 54 return true; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void TrackpadInputStrategy::TrackTouchInput( | 57 bool TrackpadInputStrategy::TrackTouchInput( |
| 58 const ViewMatrix::Point& touch_point, | 58 const ViewMatrix::Point& touch_point, |
| 59 const DesktopViewport& viewport) { | 59 const DesktopViewport& viewport) { |
| 60 // Do nothing. The cursor position is independent of the touch position. | 60 // Do nothing. The cursor position is independent of the touch position. |
| 61 // |touch_point| is always valid. |
| 62 return true; |
| 61 } | 63 } |
| 62 | 64 |
| 63 ViewMatrix::Point TrackpadInputStrategy::GetCursorPosition() const { | 65 ViewMatrix::Point TrackpadInputStrategy::GetCursorPosition() const { |
| 64 return cursor_position_; | 66 return cursor_position_; |
| 65 } | 67 } |
| 66 | 68 |
| 67 ViewMatrix::Vector2D TrackpadInputStrategy::MapScreenVectorToDesktop( | 69 ViewMatrix::Vector2D TrackpadInputStrategy::MapScreenVectorToDesktop( |
| 68 const ViewMatrix::Vector2D& delta, | 70 const ViewMatrix::Vector2D& delta, |
| 69 const DesktopViewport& viewport) const { | 71 const DesktopViewport& viewport) const { |
| 70 // No conversion is needed for trackpad mode. | 72 // No conversion is needed for trackpad mode. |
| 71 return delta; | 73 return delta; |
| 72 } | 74 } |
| 73 | 75 |
| 74 float TrackpadInputStrategy::GetFeedbackRadius(InputFeedbackType type) const { | 76 float TrackpadInputStrategy::GetFeedbackRadius(InputFeedbackType type) const { |
| 75 switch (type) { | 77 switch (type) { |
| 76 case InputFeedbackType::TAP_FEEDBACK: | 78 case InputFeedbackType::TAP_FEEDBACK: |
| 77 return kTapFeedbackRadius; | 79 return kTapFeedbackRadius; |
| 78 case InputFeedbackType::DRAG_FEEDBACK: | 80 case InputFeedbackType::DRAG_FEEDBACK: |
| 79 return kDragFeedbackRadius; | 81 return kDragFeedbackRadius; |
| 80 } | 82 } |
| 81 NOTREACHED(); | 83 NOTREACHED(); |
| 82 return 0.f; | 84 return 0.f; |
| 83 } | 85 } |
| 84 | 86 |
| 85 bool TrackpadInputStrategy::IsCursorVisible() const { | 87 bool TrackpadInputStrategy::IsCursorVisible() const { |
| 86 return true; | 88 return true; |
| 87 } | 89 } |
| 88 } // namespace remoting | 90 } // namespace remoting |
| OLD | NEW |