Commit 78877323 authored by asimjour's avatar asimjour Committed by Commit bot

VR: Sending the fling event to the right target

Fling event is sent to the same target that the last scroll event
was sent to.

BUG=698260

Review-Url: https://codereview.chromium.org/2808723003
Cr-Commit-Position: refs/heads/master@{#464419}
parent 6ea1b0ee
......@@ -727,25 +727,37 @@ void VrShellGl::SendEventsToTarget(InputTarget input_target,
// Once the user starts scrolling send all the scroll events to this
// element until the scrolling stops.
case WebInputEvent::kGestureScrollBegin:
current_scroll_target = input_target;
if (current_scroll_target != InputTarget::NONE) {
SendGesture(current_scroll_target, std::move(movableGesture));
current_scroll_target_ = input_target;
if (current_scroll_target_ != InputTarget::NONE) {
SendGesture(current_scroll_target_, std::move(movableGesture));
}
break;
case WebInputEvent::kGestureScrollEnd:
if (current_scroll_target != InputTarget::NONE) {
SendGesture(current_scroll_target, std::move(movableGesture));
if (current_scroll_target_ != InputTarget::NONE) {
SendGesture(current_scroll_target_, std::move(movableGesture));
}
current_scroll_target = InputTarget::NONE;
current_fling_target_ = current_scroll_target_;
current_scroll_target_ = InputTarget::NONE;
break;
case WebInputEvent::kGestureScrollUpdate:
case WebInputEvent::kGestureFlingCancel:
if (current_scroll_target_ != InputTarget::NONE) {
SendGesture(current_scroll_target_, std::move(movableGesture));
}
break;
case WebInputEvent::kGestureFlingStart:
if (current_scroll_target != InputTarget::NONE) {
SendGesture(current_scroll_target, std::move(movableGesture));
if (current_fling_target_ != InputTarget::NONE) {
SendGesture(current_fling_target_, std::move(movableGesture));
}
current_fling_target_ = InputTarget::NONE;
break;
case WebInputEvent::kGestureFlingCancel:
current_fling_target_ = InputTarget::NONE;
if (input_target != InputTarget::NONE) {
SendGesture(input_target, std::move(movableGesture));
}
break;
case WebInputEvent::kGestureTapDown:
current_fling_target_ = InputTarget::NONE;
if (input_target != InputTarget::NONE) {
SendGesture(input_target, std::move(movableGesture));
}
......
......@@ -200,7 +200,8 @@ class VrShellGl : public device::mojom::VRVSyncProvider {
gfx::Point3F target_point_;
const UiElement* target_element_ = nullptr;
InputTarget current_input_target_ = InputTarget::NONE;
InputTarget current_scroll_target = InputTarget::NONE;
InputTarget current_scroll_target_ = InputTarget::NONE;
InputTarget current_fling_target_ = InputTarget::NONE;
int ui_tex_css_width_ = 0;
int ui_tex_css_height_ = 0;
int content_tex_css_width_ = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment