| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "remoting/client/direct_input_strategy.h" | |
| 6 #include "remoting/client/desktop_viewport.h" | |
| 7 | |
| 8 namespace remoting { | |
| 9 | |
| 10 DirectInputStrategy::DirectInputStrategy() {} | |
| 11 | |
| 12 DirectInputStrategy::~DirectInputStrategy() {} | |
| 13 | |
| 14 void DirectInputStrategy::HandlePinch(float pivot_x, | |
| 15 float pivot_y, | |
| 16 float scale, | |
| 17 DesktopViewport* viewport) { | |
| 18 viewport->ScaleDesktop(pivot_x, pivot_y, scale); | |
| 19 } | |
| 20 | |
| 21 void DirectInputStrategy::HandlePan(float translation_x, | |
| 22 float translation_y, | |
| 23 bool is_dragging_mode, | |
| 24 DesktopViewport* viewport) { | |
| 25 if (is_dragging_mode) { | |
| 26 // If the user is dragging something, we should synchronize the movement | |
| 27 // with the object that the user is trying to move on the desktop, rather | |
| 28 // than moving the desktop around. | |
| 29 ViewMatrix::Vector2D viewport_movement = | |
| 30 viewport->GetTransformation().Invert().MapVector( | |
| 31 {translation_x, translation_y}); | |
| 32 viewport->MoveViewport(viewport_movement.x, viewport_movement.y); | |
| 33 return; | |
| 34 } | |
| 35 | |
| 36 viewport->MoveDesktop(translation_x, translation_y); | |
| 37 } | |
| 38 | |
| 39 void DirectInputStrategy::FindCursorPositions(float touch_x, | |
| 40 float touch_y, | |
| 41 const DesktopViewport& viewport, | |
| 42 float* cursor_x, | |
| 43 float* cursor_y) { | |
| 44 ViewMatrix::Point cursor_position = | |
| 45 viewport.GetTransformation().Invert().MapPoint({touch_x, touch_y}); | |
| 46 *cursor_x = cursor_position.x; | |
| 47 *cursor_y = cursor_position.y; | |
| 48 } | |
| 49 | |
| 50 bool DirectInputStrategy::IsCursorVisible() const { | |
| 51 return false; | |
| 52 } | |
| 53 | |
| 54 } // namespace remoting | |
| OLD | NEW |