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

Unified Diff: remoting/client/direct_input_strategy.cc

Issue 2879743002: [CRD iOS] Hook the touch input feedback (Closed)
Patch Set: Use the ui task poster 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
Index: remoting/client/direct_input_strategy.cc
diff --git a/remoting/client/direct_input_strategy.cc b/remoting/client/direct_input_strategy.cc
index 13d54faa9d881cafbb5e6ce6ca6fd546530fae15..e7cf925fbfef303a3e12bac9bdd5d84263aa8df2 100644
--- a/remoting/client/direct_input_strategy.cc
+++ b/remoting/client/direct_input_strategy.cc
@@ -3,10 +3,18 @@
// found in the LICENSE file.
#include "remoting/client/direct_input_strategy.h"
+
#include "remoting/client/desktop_viewport.h"
namespace remoting {
+namespace {
+
+const float kTapFeedbackRadius = 25.f;
+const float kLongPressFeedbackRadius = 55.f;
+
+} // namespace
+
DirectInputStrategy::DirectInputStrategy() {}
DirectInputStrategy::~DirectInputStrategy() {}
@@ -36,15 +44,30 @@ void DirectInputStrategy::HandlePan(float translation_x,
viewport->MoveDesktop(translation_x, translation_y);
}
-void DirectInputStrategy::FindCursorPositions(float touch_x,
- float touch_y,
- const DesktopViewport& viewport,
- float* cursor_x,
- float* cursor_y) {
+void DirectInputStrategy::TrackTouchInput(float touch_x,
+ float touch_y,
+ const DesktopViewport& viewport) {
ViewMatrix::Point cursor_position =
viewport.GetTransformation().Invert().MapPoint({touch_x, touch_y});
- *cursor_x = cursor_position.x;
- *cursor_y = cursor_position.y;
+ cursor_x_ = cursor_position.x;
+ cursor_y_ = cursor_position.y;
+}
+
+void DirectInputStrategy::GetCursorPosition(float* cursor_x,
+ float* cursor_y) const {
+ *cursor_x = cursor_x_;
+ *cursor_y = cursor_y_;
+}
+
+float DirectInputStrategy::GetFeedbackRadius(InputFeedbackType type) const {
+ switch (type) {
+ case InputFeedbackType::TAP_FEEDBACK:
+ return kTapFeedbackRadius;
+ case InputFeedbackType::LONG_PRESS_FEEDBACK:
+ return kLongPressFeedbackRadius;
+ default:
+ NOTREACHED();
+ }
}
bool DirectInputStrategy::IsCursorVisible() const {

Powered by Google App Engine
This is Rietveld 408576698