diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-13 21:38:37 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-13 21:38:37 +0000 |
commit | 47b335d52ad0fbbaeec12d534bdd58361851c3a1 (patch) | |
tree | 70298d8b68b492fbe0843318f7294c016f5b4a04 /mojo | |
parent | 0ce1a84e76a46bcea5e084c7c7c6d1154363f1ba (diff) | |
download | chromium_src-47b335d52ad0fbbaeec12d534bdd58361851c3a1.zip chromium_src-47b335d52ad0fbbaeec12d534bdd58361851c3a1.tar.gz chromium_src-47b335d52ad0fbbaeec12d534bdd58361851c3a1.tar.bz2 |
Only change the spinning cube color on right click.
This makes it so that changing color doesn't prevent
rotation. It also means that you can't change color on touch
devices, but that can be a fix for another day.
BUG=
R=davemoore@chromium.org
Review URL: https://codereview.chromium.org/330673002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277086 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r-- | mojo/examples/sample_app/gles2_client_impl.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/mojo/examples/sample_app/gles2_client_impl.cc b/mojo/examples/sample_app/gles2_client_impl.cc index 82ab114..eb571b4 100644 --- a/mojo/examples/sample_app/gles2_client_impl.cc +++ b/mojo/examples/sample_app/gles2_client_impl.cc @@ -52,6 +52,8 @@ void GLES2ClientImpl::HandleInputEvent(const Event& event) { switch (event.action) { case ui::ET_MOUSE_PRESSED: case ui::ET_TOUCH_PRESSED: + if (event.flags & ui::EF_RIGHT_MOUSE_BUTTON) + break; CancelAnimationFrames(); capture_point_.SetPoint(event.location->x, event.location->y); last_drag_point_ = capture_point_; @@ -59,6 +61,8 @@ void GLES2ClientImpl::HandleInputEvent(const Event& event) { break; case ui::ET_MOUSE_DRAGGED: case ui::ET_TOUCH_MOVED: + if (event.flags & ui::EF_RIGHT_MOUSE_BUTTON) + break; if (!getting_animation_frames_) { int direction = event.location->y < last_drag_point_.y() || event.location->x > last_drag_point_.x() ? 1 : -1; @@ -73,18 +77,20 @@ void GLES2ClientImpl::HandleInputEvent(const Event& event) { break; case ui::ET_MOUSE_RELEASED: case ui::ET_TOUCH_RELEASED: { - MojoTimeTicks offset = GetTimeTicksNow() - drag_start_time_; - float delta = static_cast<float>(offset) / 1000000.; - cube_.SetFlingMultiplier( - CalculateDragDistance(capture_point_, *event.location), - delta); - + if (event.flags & ui::EF_RIGHT_MOUSE_BUTTON) { cube_.set_color(GetRandomColor(), GetRandomColor(), GetRandomColor()); - - capture_point_ = last_drag_point_ = gfx::PointF(); - RequestAnimationFrames(); + break; } + MojoTimeTicks offset = GetTimeTicksNow() - drag_start_time_; + float delta = static_cast<float>(offset) / 1000000.; + cube_.SetFlingMultiplier( + CalculateDragDistance(capture_point_, *event.location), + delta); + + capture_point_ = last_drag_point_ = gfx::PointF(); + RequestAnimationFrames(); break; + } default: break; } |