Chromium Code Reviews| Index: ui/views/animation/ink_drop_hover.h |
| diff --git a/ui/views/animation/ink_drop_hover.h b/ui/views/animation/ink_drop_hover.h |
| index 66c38c263041e6a20d6e3c4628e08032236d569d..806ad8d57858c19c6e476e07b97836ffbe5e7a94 100644 |
| --- a/ui/views/animation/ink_drop_hover.h |
| +++ b/ui/views/animation/ink_drop_hover.h |
| @@ -11,7 +11,10 @@ |
| #include "base/time/time.h" |
| #include "third_party/skia/include/core/SkColor.h" |
| #include "ui/gfx/geometry/point.h" |
| +#include "ui/gfx/geometry/point_f.h" |
| #include "ui/gfx/geometry/size.h" |
| +#include "ui/gfx/geometry/size_f.h" |
| +#include "ui/gfx/transform.h" |
| #include "ui/views/views_export.h" |
| namespace ui { |
| @@ -32,6 +35,8 @@ class VIEWS_EXPORT InkDropHover { |
| SkColor color); |
| ~InkDropHover(); |
| + void set_explode_size(const gfx::SizeF& size) { explode_size_ = size; } |
|
varkha
2016/04/21 16:16:49
Do you think this class should decide to use Size
varkha
2016/04/21 16:16:49
It may be simpler (less flexible but I don't think
bruthig
2016/04/21 21:14:04
Updated to use Size.
bruthig
2016/04/21 21:14:04
Discussed with varkha@ offline. We will defer dec
|
| + |
| // Returns true if the hover animation is either in the process of fading |
| // in or is fully visible. |
| bool IsFadingInOrVisible() const; |
| @@ -40,7 +45,7 @@ class VIEWS_EXPORT InkDropHover { |
| void FadeIn(const base::TimeDelta& duration); |
| // Fades out the hover visual over the given |duration|. |
|
varkha
2016/04/21 16:16:49
nit: Document |explode|.
bruthig
2016/04/21 21:14:04
Done.
|
| - void FadeOut(const base::TimeDelta& duration); |
| + void FadeOut(const base::TimeDelta& duration, bool explode); |
| // The root Layer that can be added in to a Layer tree. |
| ui::Layer* layer() { return layer_.get(); } |
| @@ -48,16 +53,32 @@ class VIEWS_EXPORT InkDropHover { |
| private: |
| enum HoverAnimationType { FADE_IN, FADE_OUT }; |
| - // Animates a fade in/out as specified by |animation_type| over the given |
| - // |duration|. |
| + // Animates a fade in/out as specified by |animation_type| combined with a |
| + // transformation from the |initial_transform| to the |target_transform| over |
| + // the given |duration|. |
| void AnimateFade(HoverAnimationType animation_type, |
| - const base::TimeDelta& duration); |
| + const base::TimeDelta& duration, |
| + const gfx::Transform& initial_transform, |
| + const gfx::Transform& target_transform); |
| + |
| + // Calculates the Transform to apply to |layer_| for the given |size|. |
| + gfx::Transform CalculateTransform(const gfx::SizeF& size) const; |
| // The callback that will be invoked when a fade in/out animation is complete. |
| bool AnimationEndedCallback( |
| HoverAnimationType animation_type, |
| const ui::CallbackLayerAnimationObserver& observer); |
| + // The size of the hover shape when fully faded in. |
| + gfx::SizeF size_; |
| + |
| + // The target size of the hover shape when it expands during a fade out |
| + // animation. |
| + gfx::SizeF explode_size_; |
| + |
| + // The center point of the hover shape in the parent Layer's coordinate space. |
| + gfx::PointF center_point_; |
| + |
| // True if the last animation to be initiated was a FADE_IN, and false |
| // otherwise. |
| bool last_animation_initiated_was_fade_in_; |