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

Unified Diff: ui/views/animation/ink_drop_hover.h

Issue 1890243002: Expand the Material Design hover as it fades out when a ripple is triggered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed ink_drop_hover_unittest.cc compile error. Created 4 years, 8 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
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_;

Powered by Google App Engine
This is Rietveld 408576698