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

Side by Side Diff: remoting/client/ios/client_gestures.mm

Issue 2856933007: [Remoting iOS] Basic viewport manipulation support (Closed)
Patch Set: Move the delegate getter/setting to the bottom 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 unified diff | Download patch
« no previous file with comments | « remoting/client/ios/client_gestures.h ('k') | remoting/client/ios/display/gl_display_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if !defined(__has_feature) || !__has_feature(objc_arc) 5 #if !defined(__has_feature) || !__has_feature(objc_arc)
6 #error "This file requires ARC support." 6 #error "This file requires ARC support."
7 #endif 7 #endif
8 8
9 #import "remoting/client/ios/client_gestures.h" 9 #import "remoting/client/ios/client_gestures.h"
10 #import "remoting/client/ios/session/remoting_client.h"
11
12 #include "remoting/client/gesture_interpreter.h"
10 13
11 @implementation ClientGestures 14 @implementation ClientGestures
12 15
13 - (id)initWithView:(UIView*)view { 16 - (instancetype)initWithView:(UIView*)view client:(RemotingClient*)client {
17 _view = view;
18 _client = client;
19
14 _inputScheme = HostInputSchemeTouch; 20 _inputScheme = HostInputSchemeTouch;
15 21
16 _longPressRecognizer = [[UILongPressGestureRecognizer alloc] 22 _longPressRecognizer = [[UILongPressGestureRecognizer alloc]
17 initWithTarget:self 23 initWithTarget:self
18 action:@selector(longPressGestureTriggered:)]; 24 action:@selector(longPressGestureTriggered:)];
19 _longPressRecognizer.delegate = self; 25 _longPressRecognizer.delegate = self;
20 [view addGestureRecognizer:_longPressRecognizer]; 26 [view addGestureRecognizer:_longPressRecognizer];
21 27
22 _panRecognizer = [[UIPanGestureRecognizer alloc] 28 _panRecognizer = [[UIPanGestureRecognizer alloc]
23 initWithTarget:self 29 initWithTarget:self
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Integreation with the original implementation will be done with the app 98 // Integreation with the original implementation will be done with the app
93 // is able to run to the point of interaction and debugging can happen. 99 // is able to run to the point of interaction and debugging can happen.
94 // I would prefer to leave this here rather than deleting because it is close 100 // I would prefer to leave this here rather than deleting because it is close
95 // to the implementation that will be used client gestures integration. 101 // to the implementation that will be used client gestures integration.
96 // This is a new class that was derived from the original source which had 102 // This is a new class that was derived from the original source which had
97 // the implementation mixed in with the host controller and was a huge mess. 103 // the implementation mixed in with the host controller and was a huge mess.
98 104
99 // Resize the view of the desktop - Zoom in/out. This can occur during a Pan. 105 // Resize the view of the desktop - Zoom in/out. This can occur during a Pan.
100 - (IBAction)pinchGestureTriggered:(UIPinchGestureRecognizer*)sender { 106 - (IBAction)pinchGestureTriggered:(UIPinchGestureRecognizer*)sender {
101 // LOG_TRACE(INFO) << "pinchGestureTriggered"; 107 // LOG_TRACE(INFO) << "pinchGestureTriggered";
102 // if ([sender state] == UIGestureRecognizerStateChanged) { 108 if ([sender state] == UIGestureRecognizerStateChanged) {
103 // [self applySceneChange:CGPointMake(0.0, 0.0) scaleBy:sender.scale]; 109 CGPoint pivot = [sender locationInView:_view];
104 // 110 _client.gestureInterpreter->Pinch(pivot.x, pivot.y, sender.scale);
105 // sender.scale = 1.0; // reset scale so next iteration is a relative ratio 111
106 // } 112 sender.scale = 1.0; // reset scale so next iteration is a relative ratio
113 }
107 } 114 }
108 115
109 - (IBAction)tapGestureTriggered:(UITapGestureRecognizer*)sender { 116 - (IBAction)tapGestureTriggered:(UITapGestureRecognizer*)sender {
110 // LOG_TRACE(INFO) << "tapGestureTriggered"; 117 // LOG_TRACE(INFO) << "tapGestureTriggered";
111 // CGPoint touchPoint = [sender locationInView:self.view]; 118 // CGPoint touchPoint = [sender locationInView:self.view];
112 // if ([_scene containsTouchPoint:touchPoint]) { 119 // if ([_scene containsTouchPoint:touchPoint]) {
113 // if (_inputScheme == HostInputSchemeTouch) { 120 // if (_inputScheme == HostInputSchemeTouch) {
114 // [_scene setMouseLocationFromLocationInView:touchPoint]; 121 // [_scene setMouseLocationFromLocationInView:touchPoint];
115 // _circle.expandedRadius = 11.0f; 122 // _circle.expandedRadius = 11.0f;
116 // [_circle doExpandingAnimationAtLocation:[_scene mouseLocationInView]]; 123 // [_circle doExpandingAnimationAtLocation:[_scene mouseLocationInView]];
117 // } 124 // }
118 // [Utility leftClickOn:_clientToHostProxy at:_scene.mousePosition]; 125 // [Utility leftClickOn:_clientToHostProxy at:_scene.mousePosition];
119 // } 126 // }
120 } 127 }
121 128
122 // Change position of scene. This can occur during a pinch or long press. 129 // Change position of scene. This can occur during a pinch or long press.
123 // Or perform a Mouse Wheel Scroll. 130 // Or perform a Mouse Wheel Scroll.
131 // TODO(yuweih): The comment above doesn't seem right. Non-panning gestures
132 // should be moved out of this method.
124 - (IBAction)panGestureTriggered:(UIPanGestureRecognizer*)sender { 133 - (IBAction)panGestureTriggered:(UIPanGestureRecognizer*)sender {
134 // TODO(yuweih): Need deceleration animation, probably in another class.
135 if ([sender state] == UIGestureRecognizerStateChanged &&
136 [sender numberOfTouches] == 1) {
137 CGPoint translation = [sender translationInView:_view];
138 _client.gestureInterpreter->Pan(translation.x, translation.y);
139
140 // Reset translation so next iteration is relative
141 [sender setTranslation:CGPointZero inView:_view];
142 }
143
125 // LOG_TRACE(INFO) << "panGestureTriggered"; 144 // LOG_TRACE(INFO) << "panGestureTriggered";
126 // CGPoint translation = [sender translationInView:self.view]; 145 // CGPoint translation = [sender translationInView:self.view];
127 // // If we start with 2 touches, and the pinch gesture is not in progress 146 // // If we start with 2 touches, and the pinch gesture is not in progress
128 // yet, 147 // yet,
129 // // then disable it, so mouse scrolling and zoom do not occur at the same 148 // // then disable it, so mouse scrolling and zoom do not occur at the same
130 // // time. 149 // // time.
131 // if ([sender numberOfTouches] == 2 && 150 // if ([sender numberOfTouches] == 2 &&
132 // [sender state] == UIGestureRecognizerStateBegan && 151 // [sender state] == UIGestureRecognizerStateBegan &&
133 // !(_pinchRecognizer.state == UIGestureRecognizerStateBegan || 152 // !(_pinchRecognizer.state == UIGestureRecognizerStateBegan ||
134 // _pinchRecognizer.state == UIGestureRecognizerStateChanged)) { 153 // _pinchRecognizer.state == UIGestureRecognizerStateChanged)) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 otherGestureRecognizer == _edgeGesture) { 349 otherGestureRecognizer == _edgeGesture) {
331 return YES; 350 return YES;
332 } 351 }
333 // TODO(nicholss): If we return NO here, it dismisses the other reconizers. 352 // TODO(nicholss): If we return NO here, it dismisses the other reconizers.
334 // As we add more types of reconizers, they need to be accounted for in the 353 // As we add more types of reconizers, they need to be accounted for in the
335 // above logic. 354 // above logic.
336 return NO; 355 return NO;
337 } 356 }
338 357
339 @end 358 @end
OLDNEW
« no previous file with comments | « remoting/client/ios/client_gestures.h ('k') | remoting/client/ios/display/gl_display_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698