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

Unified Diff: remoting/client/ui/direct_input_strategy.cc

Issue 2879743002: [CRD iOS] Hook the touch input feedback (Closed)
Patch Set: Fix dependency and race condition 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/ui/direct_input_strategy.cc
diff --git a/remoting/client/ui/direct_input_strategy.cc b/remoting/client/ui/direct_input_strategy.cc
index f4d637556f25646c49584b286260669574c49677..4fa23527431cddf2b2d5b5ee5043f367110ffb3b 100644
--- a/remoting/client/ui/direct_input_strategy.cc
+++ b/remoting/client/ui/direct_input_strategy.cc
@@ -7,19 +7,24 @@
namespace remoting {
+namespace {
+
+const float kTapFeedbackRadius = 25.f;
+const float kLongPressFeedbackRadius = 55.f;
+
+} // namespace
+
DirectInputStrategy::DirectInputStrategy() {}
DirectInputStrategy::~DirectInputStrategy() {}
-void DirectInputStrategy::HandlePinch(float pivot_x,
- float pivot_y,
+void DirectInputStrategy::HandlePinch(const ViewMatrix::Point& pivot,
float scale,
DesktopViewport* viewport) {
- viewport->ScaleDesktop(pivot_x, pivot_y, scale);
+ viewport->ScaleDesktop(pivot.x, pivot.y, scale);
}
-void DirectInputStrategy::HandlePan(float translation_x,
- float translation_y,
+void DirectInputStrategy::HandlePan(const ViewMatrix::Vector2D& translation,
bool is_dragging_mode,
DesktopViewport* viewport) {
if (is_dragging_mode) {
@@ -27,24 +32,33 @@ void DirectInputStrategy::HandlePan(float translation_x,
// with the object that the user is trying to move on the desktop, rather
// than moving the desktop around.
ViewMatrix::Vector2D viewport_movement =
- viewport->GetTransformation().Invert().MapVector(
- {translation_x, translation_y});
+ viewport->GetTransformation().Invert().MapVector(translation);
viewport->MoveViewport(viewport_movement.x, viewport_movement.y);
return;
}
- viewport->MoveDesktop(translation_x, translation_y);
+ viewport->MoveDesktop(translation.x, translation.y);
+}
+
+void DirectInputStrategy::TrackTouchInput(const ViewMatrix::Point& touch_point,
+ const DesktopViewport& viewport) {
+ cursor_position_ =
+ viewport.GetTransformation().Invert().MapPoint(touch_point);
+}
+
+ViewMatrix::Point DirectInputStrategy::GetCursorPosition() const {
+ return cursor_position_;
}
-void DirectInputStrategy::FindCursorPositions(float touch_x,
- float touch_y,
- const DesktopViewport& viewport,
- float* cursor_x,
- float* cursor_y) {
- ViewMatrix::Point cursor_position =
- viewport.GetTransformation().Invert().MapPoint({touch_x, touch_y});
- *cursor_x = cursor_position.x;
- *cursor_y = cursor_position.y;
+float DirectInputStrategy::GetFeedbackRadius(InputFeedbackType type) const {
+ switch (type) {
+ case InputFeedbackType::TAP_FEEDBACK:
+ return kTapFeedbackRadius;
+ case InputFeedbackType::LONG_PRESS_FEEDBACK:
+ return kLongPressFeedbackRadius;
+ }
+ NOTREACHED();
+ return 0.f;
}
bool DirectInputStrategy::IsCursorVisible() const {
« 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