Commit 3ce4924b authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

CrOS Shelf: Animate changes in the hotseat background's width

Bug: 1042491
Change-Id: I28e5d2ffb9a960e1146a8b6496ffd920e5d56509
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2035867Reviewed-by: default avatarAndrew Xu <andrewxu@chromium.org>
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737872}
parent 35c7a788
......@@ -173,15 +173,23 @@ void HotseatWidget::DelegateView::SetTranslucentBackground(
translucent_background_.SetVisible(true);
// Animate the bounds change if we're changing the background, or if there's
// a change of width (for instance when dragging an app into, or out of,
// the shelf.
bool animate =
ShelfConfig::Get()->GetDefaultShelfColor() != target_color_ ||
background_bounds.width() != translucent_background_.bounds().width();
ui::ScopedLayerAnimationSettings animation_setter(
translucent_background_.GetAnimator());
animation_setter.SetTransitionDuration(
animate ? ShelfConfig::Get()->shelf_animation_duration()
: base::TimeDelta::FromMilliseconds(0));
animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
animation_setter.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
if (ShelfConfig::Get()->GetDefaultShelfColor() != target_color_) {
target_color_ = ShelfConfig::Get()->GetDefaultShelfColor();
ui::ScopedLayerAnimationSettings animation_setter(
translucent_background_.GetAnimator());
animation_setter.SetTransitionDuration(
ShelfConfig::Get()->shelf_animation_duration());
animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
animation_setter.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
translucent_background_.SetColor(target_color_);
}
......
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