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

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..617e9a2b8bc28791ebd4d62866c65c617f525543 100644
--- a/chrome/browser/android/vr_shell/vr_controller.cc
+++ b/chrome/browser/android/vr_shell/vr_controller.cc
@@ -202,10 +202,23 @@ std::vector<std::unique_ptr<WebGestureEvent>> VrController::DetectGestures() {
gesture->data.tapDown.width = 0;
gesture->data.tapDown.height = 0;
}
+
+ if (state_ == SCROLLING && IsButtonDown(gvr::kControllerButtonClick))
mthiesse 2016/11/28 16:06:57 nit: extract "state_ == SCROLLING && IsButtonDown(
bshe 2016/11/28 16:33:57 can this logic move to HandleScrollingState ? It p
asimjour1 2016/11/28 21:38:04 Done.
asimjour1 2016/11/28 21:38:04 This part is moved and there is no duplication any
+ gesture->type = WebInputEvent::GestureScrollEnd;
+
gesture->sourceDevice = blink::WebGestureDeviceTouchpad;
gesture_list.push_back(std::move(gesture));
- if (gesture_list.back()->type == WebInputEvent::GestureScrollEnd) {
+ if (state_ == SCROLLING && IsButtonDown(gvr::kControllerButtonClick)) {
+ 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;
@@ -270,7 +283,8 @@ void VrController::HandleDetectingState(WebGestureEvent* gesture) {
// Touch position is changed and the touch point moves outside of slop.
bshe 2016/11/28 16:33:57 update the comment here to include buttondown dete
asimjour1 2016/11/28 21:38:04 Done.
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);
« 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