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

Unified Diff: ash/frame/caption_buttons/frame_caption_button.cc

Issue 994303004: Show hovered and pressed unfocused ash caption buttons as active. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/frame/caption_buttons/frame_caption_button.cc
diff --git a/ash/frame/caption_buttons/frame_caption_button.cc b/ash/frame/caption_buttons/frame_caption_button.cc
index 7845efe9e0a66be4df0fc529702618f6bd89484e..124f4363df2c093a5f6fdc7bb351f3c1d5e27768 100644
--- a/ash/frame/caption_buttons/frame_caption_button.cc
+++ b/ash/frame/caption_buttons/frame_caption_button.cc
@@ -170,8 +170,19 @@ 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() || state() == STATE_HOVERED) {
oshima 2015/03/17 17:31:39 if (hover_animation_->is_animating()) inactive_a
benwells 2015/03/17 23:24:54 Done.
+ inactive_alpha =
+ hover_animation_->is_animating()
+ ? hover_animation_->CurrentValueBetween(inactive_alpha, 1.0f)
+ : 1.0f;
+ } else if (state() == STATE_PRESSED) {
+ inactive_alpha = 1.0f;
+ }
+ alpha *= inactive_alpha;
+ }
SkPaint paint;
paint.setAlpha(alpha);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698