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

Unified Diff: remoting/client/gesture_interpreter.cc

Issue 2856933007: [Remoting iOS] Basic viewport manipulation support (Closed)
Patch Set: Resolve Feedbacks Created 3 years, 8 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/gesture_interpreter.cc
diff --git a/remoting/client/gesture_interpreter.cc b/remoting/client/gesture_interpreter.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bbdd7d8bcae28729c436cd7450434ad3bd147cc3
--- /dev/null
+++ b/remoting/client/gesture_interpreter.cc
@@ -0,0 +1,45 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/client/gesture_interpreter.h"
+
+#include "base/logging.h"
+
+namespace remoting {
+
+GestureInterpreter::GestureInterpreter(
+ const DesktopViewport::TransformationCallback& on_transformation_changed) {
+ viewport_.RegisterOnTransformationChangedCallback(on_transformation_changed,
+ true);
+}
+
+GestureInterpreter::~GestureInterpreter() {}
+
+void GestureInterpreter::Pinch(float pivot_x, float pivot_y, float scale) {
+ viewport_.ScaleDesktop(pivot_x, pivot_y, scale);
+}
+
+void GestureInterpreter::Pan(float translation_x, float translation_y) {
+ // TODO(yuweih): Handle trackpad mode where the viewport always focus on the
+ // cursor.
+ viewport_.MoveDesktop(translation_x, translation_y);
+}
+
+void GestureInterpreter::Tap(float x, float y) {
+ NOTIMPLEMENTED();
+}
+
+void GestureInterpreter::LongPress(float x, float y) {
+ NOTIMPLEMENTED();
+}
+
+void GestureInterpreter::OnSurfaceSizeChanged(int width, int height) {
+ viewport_.SetSurfaceSize(width, height);
+}
+
+void GestureInterpreter::OnDesktopSizeChanged(int width, int height) {
+ viewport_.SetDesktopSize(width, height);
+}
+
+} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698