| OLD | NEW |
| 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" | 10 #import "remoting/client/ios/session/remoting_client.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // LOG_TRACE(INFO) << "pinchGestureTriggered"; | 107 // LOG_TRACE(INFO) << "pinchGestureTriggered"; |
| 108 if ([sender state] == UIGestureRecognizerStateChanged) { | 108 if ([sender state] == UIGestureRecognizerStateChanged) { |
| 109 CGPoint pivot = [sender locationInView:_view]; | 109 CGPoint pivot = [sender locationInView:_view]; |
| 110 _client.gestureInterpreter->Pinch(pivot.x, pivot.y, sender.scale); | 110 _client.gestureInterpreter->Pinch(pivot.x, pivot.y, sender.scale); |
| 111 | 111 |
| 112 sender.scale = 1.0; // reset scale so next iteration is a relative ratio | 112 sender.scale = 1.0; // reset scale so next iteration is a relative ratio |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 - (IBAction)tapGestureTriggered:(UITapGestureRecognizer*)sender { | 116 - (IBAction)tapGestureTriggered:(UITapGestureRecognizer*)sender { |
| 117 // LOG_TRACE(INFO) << "tapGestureTriggered"; | 117 CGPoint touchPoint = [sender locationInView:_view]; |
| 118 // CGPoint touchPoint = [sender locationInView:self.view]; | 118 _client.gestureInterpreter->Tap(touchPoint.x, touchPoint.y); |
| 119 // if ([_scene containsTouchPoint:touchPoint]) { | |
| 120 // if (_inputScheme == HostInputSchemeTouch) { | |
| 121 // [_scene setMouseLocationFromLocationInView:touchPoint]; | |
| 122 // _circle.expandedRadius = 11.0f; | |
| 123 // [_circle doExpandingAnimationAtLocation:[_scene mouseLocationInView]]; | |
| 124 // } | |
| 125 // [Utility leftClickOn:_clientToHostProxy at:_scene.mousePosition]; | |
| 126 // } | |
| 127 } | 119 } |
| 128 | 120 |
| 129 // Change position of scene. This can occur during a pinch or long press. | 121 // Change position of scene. This can occur during a pinch or long press. |
| 130 // Or perform a Mouse Wheel Scroll. | 122 // Or perform a Mouse Wheel Scroll. |
| 131 // TODO(yuweih): The comment above doesn't seem right. Non-panning gestures | 123 // TODO(yuweih): The comment above doesn't seem right. Non-panning gestures |
| 132 // should be moved out of this method. | 124 // should be moved out of this method. |
| 133 - (IBAction)panGestureTriggered:(UIPanGestureRecognizer*)sender { | 125 - (IBAction)panGestureTriggered:(UIPanGestureRecognizer*)sender { |
| 134 // TODO(yuweih): Need deceleration animation, probably in another class. | 126 // TODO(yuweih): Need deceleration animation, probably in another class. |
| 135 if ([sender state] == UIGestureRecognizerStateChanged && | 127 if ([sender state] == UIGestureRecognizerStateChanged && |
| 136 [sender numberOfTouches] == 1) { | 128 [sender numberOfTouches] == 1) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // // event in order to also capture the portion of the translation that | 223 // // event in order to also capture the portion of the translation that |
| 232 // occurred | 224 // occurred |
| 233 // // between the Began and Changed States. | 225 // // between the Began and Changed States. |
| 234 // if ([sender state] == UIGestureRecognizerStateChanged) { | 226 // if ([sender state] == UIGestureRecognizerStateChanged) { |
| 235 // [sender setTranslation:CGPointZero inView:self.view]; | 227 // [sender setTranslation:CGPointZero inView:self.view]; |
| 236 // } | 228 // } |
| 237 } | 229 } |
| 238 | 230 |
| 239 // Click-Drag mouse operation. This can occur during a Pan. | 231 // Click-Drag mouse operation. This can occur during a Pan. |
| 240 - (IBAction)longPressGestureTriggered:(UILongPressGestureRecognizer*)sender { | 232 - (IBAction)longPressGestureTriggered:(UILongPressGestureRecognizer*)sender { |
| 233 CGPoint touchPoint = [sender locationInView:_view]; |
| 234 remoting::GestureInterpreter::GestureState state; |
| 235 switch ([sender state]) { |
| 236 case UIGestureRecognizerStateBegan: |
| 237 state = remoting::GestureInterpreter::GESTURE_BEGAN; |
| 238 break; |
| 239 case UIGestureRecognizerStateChanged: |
| 240 state = remoting::GestureInterpreter::GESTURE_CHANGED; |
| 241 break; |
| 242 default: |
| 243 state = remoting::GestureInterpreter::GESTURE_ENDED; |
| 244 } |
| 245 _client.gestureInterpreter->LongPress(touchPoint.x, touchPoint.y, state); |
| 246 |
| 241 // LOG_TRACE(INFO) << "longPressGestureTriggered"; | 247 // LOG_TRACE(INFO) << "longPressGestureTriggered"; |
| 242 // if ([sender state] == UIGestureRecognizerStateBegan) { | 248 // if ([sender state] == UIGestureRecognizerStateBegan) { |
| 243 // if (_inputScheme == HostInputSchemeTouch) { | 249 // if (_inputScheme == HostInputSchemeTouch) { |
| 244 // CGPoint touchPoint = [sender locationInView:self.view]; | 250 // CGPoint touchPoint = [sender locationInView:self.view]; |
| 245 // [_scene setMouseLocationFromLocationInView:touchPoint]; | 251 // [_scene setMouseLocationFromLocationInView:touchPoint]; |
| 246 // } | 252 // } |
| 247 // [_clientToHostProxy mouseAction:_scene.mousePosition | 253 // [_clientToHostProxy mouseAction:_scene.mousePosition |
| 248 // wheelDelta:webrtc::DesktopVector(0, 0) | 254 // wheelDelta:webrtc::DesktopVector(0, 0) |
| 249 // whichButton:1 | 255 // whichButton:1 |
| 250 // buttonDown:YES]; | 256 // buttonDown:YES]; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 264 // whichButton:1 | 270 // whichButton:1 |
| 265 // buttonDown:NO]; | 271 // buttonDown:NO]; |
| 266 // if (_inputScheme == HostInputSchemeTouch) { | 272 // if (_inputScheme == HostInputSchemeTouch) { |
| 267 // // Return to the center. | 273 // // Return to the center. |
| 268 // [_scene centerMouseInView]; | 274 // [_scene centerMouseInView]; |
| 269 // } | 275 // } |
| 270 // } | 276 // } |
| 271 } | 277 } |
| 272 | 278 |
| 273 - (IBAction)twoFingerTapGestureTriggered:(UITapGestureRecognizer*)sender { | 279 - (IBAction)twoFingerTapGestureTriggered:(UITapGestureRecognizer*)sender { |
| 274 // LOG_TRACE(INFO) << "twoFingerTapGestureTriggered"; | 280 CGPoint touchPoint = [sender locationInView:_view]; |
| 275 if (_inputScheme == HostInputSchemeTouch) { | 281 _client.gestureInterpreter->TwoFingerTap(touchPoint.x, touchPoint.y); |
| 276 // disabled | |
| 277 return; | |
| 278 } | |
| 279 // if ([_scene containsTouchPoint:[sender locationInView:self.view]]) { | |
| 280 // [Utility rightClickOn:_clientToHostProxy at:_scene.mousePosition]; | |
| 281 // } | |
| 282 } | 282 } |
| 283 | 283 |
| 284 - (IBAction)threeFingerTapGestureTriggered:(UITapGestureRecognizer*)sender { | 284 - (IBAction)threeFingerTapGestureTriggered:(UITapGestureRecognizer*)sender { |
| 285 // LOG_TRACE(INFO) << "threeFingerTapGestureTriggered"; | 285 // LOG_TRACE(INFO) << "threeFingerTapGestureTriggered"; |
| 286 if (_inputScheme == HostInputSchemeTouch) { | 286 if (_inputScheme == HostInputSchemeTouch) { |
| 287 // disabled | 287 // disabled |
| 288 return; | 288 return; |
| 289 } | 289 } |
| 290 | 290 |
| 291 // if ([_scene containsTouchPoint:[sender locationInView:self.view]]) { | 291 // if ([_scene containsTouchPoint:[sender locationInView:self.view]]) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 otherGestureRecognizer == _edgeGesture) { | 349 otherGestureRecognizer == _edgeGesture) { |
| 350 return YES; | 350 return YES; |
| 351 } | 351 } |
| 352 // 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. |
| 353 // 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 |
| 354 // above logic. | 354 // above logic. |
| 355 return NO; | 355 return NO; |
| 356 } | 356 } |
| 357 | 357 |
| 358 @end | 358 @end |
| OLD | NEW |