diff options
author | benwells <benwells@chromium.org> | 2015-03-17 17:27:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-18 00:27:40 +0000 |
commit | 57101f0da8c66fbe937547cfa00d691a8e00c27b (patch) | |
tree | a1a4074c2a23eee2d8b90e6e890b4c247d168af7 | |
parent | 890ba9bfdf54ce0c69b0377b342e84c0558fce33 (diff) | |
download | chromium_src-57101f0da8c66fbe937547cfa00d691a8e00c27b.zip chromium_src-57101f0da8c66fbe937547cfa00d691a8e00c27b.tar.gz chromium_src-57101f0da8c66fbe937547cfa00d691a8e00c27b.tar.bz2 |
Show hovered and pressed unfocused ash caption buttons as active.
The caption buttons still work on unfocused captions. To indicate this
the buttons should be drawn in a more active way when hovered or
pressed.
BUG=462119
Review URL: https://codereview.chromium.org/994303004
Cr-Commit-Position: refs/heads/master@{#321031}
-rw-r--r-- | ash/frame/caption_buttons/frame_caption_button.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ash/frame/caption_buttons/frame_caption_button.cc b/ash/frame/caption_buttons/frame_caption_button.cc index 7845efe..2b16643 100644 --- a/ash/frame/caption_buttons/frame_caption_button.cc +++ b/ash/frame/caption_buttons/frame_caption_button.cc @@ -170,8 +170,17 @@ void FrameCaptionButton::OnGestureEvent(ui::GestureEvent* event) { void FrameCaptionButton::PaintCentered(gfx::Canvas* canvas, const gfx::ImageSkia& to_center, int alpha) { - if (!paint_as_active_) - alpha *= kInactiveIconAlpha; + if (!paint_as_active_) { + // Paint icons as active when they are hovered over or pressed. + double inactive_alpha = kInactiveIconAlpha; + if (hover_animation_->is_animating()) { + inactive_alpha = + hover_animation_->CurrentValueBetween(inactive_alpha, 1.0f); + } else if (state() == STATE_PRESSED || state() == STATE_HOVERED) { + inactive_alpha = 1.0f; + } + alpha *= inactive_alpha; + } SkPaint paint; paint.setAlpha(alpha); |