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

Unified Diff: chrome/browser/android/vr_shell/vr_controller.cc

Issue 2533493002: VR: Fix click during scrolling (Closed)
Patch Set: VR: Fix click during scrolling Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_shell.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_controller.cc
diff --git a/chrome/browser/android/vr_shell/vr_controller.cc b/chrome/browser/android/vr_shell/vr_controller.cc
index a3ddfb61e38a9e3a9bd5062414dd0f2201f7fb1e..c43579da57c9cf5dce0b11d2c7acf9767f21f14d 100644
--- a/chrome/browser/android/vr_shell/vr_controller.cc
+++ b/chrome/browser/android/vr_shell/vr_controller.cc
@@ -202,10 +202,20 @@ std::vector<std::unique_ptr<WebGestureEvent>> VrController::DetectGestures() {
gesture->data.tapDown.width = 0;
gesture->data.tapDown.height = 0;
}
+
bshe 2016/11/28 21:52:36 nit: remove the empty line here.
asimjour1 2016/11/29 16:10:28 Done.
gesture->sourceDevice = blink::WebGestureDeviceTouchpad;
gesture_list.push_back(std::move(gesture));
- if (gesture_list.back()->type == WebInputEvent::GestureScrollEnd) {
+ if (state_ == SCROLLING && IsButtonDown(gvr::kControllerButtonClick)) {
bshe 2016/11/28 21:52:36 nit: does it make sense to move this check into: i
asimjour1 2016/11/29 16:10:28 Done.
+ std::unique_ptr<WebGestureEvent> tap_down(new WebGestureEvent());
+ tap_down->type = WebInputEvent::GestureTapDown;
+ tap_down->timeStampSeconds = gesture_list.back()->timeStampSeconds;
+ tap_down->sourceDevice = blink::WebGestureDeviceTouchpad;
+ tap_down->data.tapDown.width = 0;
+ tap_down->data.tapDown.height = 0;
+ gesture_list.push_back(std::move(tap_down));
+ Reset();
+ } else if (gesture_list.back()->type == WebInputEvent::GestureScrollEnd) {
std::unique_ptr<WebGestureEvent> fling(new WebGestureEvent());
fling->timeStampSeconds = gesture_list.back()->timeStampSeconds;
fling->sourceDevice = blink::WebGestureDeviceTouchpad;
@@ -268,9 +278,11 @@ void VrController::HandleDetectingState(WebGestureEvent* gesture) {
return;
}
- // Touch position is changed and the touch point moves outside of slop.
+ // Touch position is changed, the touch point moves outside of slop,
+ // and the Controller's button is not down.
if (UpdateCurrentTouchpoint() && touch_info_->is_touching &&
- !InSlop(touch_info_->touch_point.position)) {
+ !InSlop(touch_info_->touch_point.position) &&
+ !IsButtonDown(gvr::kControllerButtonClick)) {
state_ = SCROLLING;
gesture->type = WebInputEvent::GestureScrollBegin;
UpdateGesture(gesture);
@@ -284,7 +296,8 @@ void VrController::HandleDetectingState(WebGestureEvent* gesture) {
void VrController::HandleScrollingState(WebGestureEvent* gesture) {
// Update current touch point.
bool touch_position_changed = UpdateCurrentTouchpoint();
- if (touch_info_->touch_up || !(touch_info_->is_touching)) {
+ if (touch_info_->touch_up || !(touch_info_->is_touching) ||
+ IsButtonDown(gvr::kControllerButtonClick)) {
// Gesture ends.
gesture->type = WebInputEvent::GestureScrollEnd;
UpdateGesture(gesture);
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698