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

Unified Diff: ui/views/animation/ink_drop_host_view.cc

Issue 1924663007: Expand the Material Design hover as it fades out when a ripple is triggered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: 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
« no previous file with comments | « ui/views/animation/ink_drop_animation_controller_impl.cc ('k') | ui/views/animation/ink_drop_hover.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/ink_drop_host_view.cc
diff --git a/ui/views/animation/ink_drop_host_view.cc b/ui/views/animation/ink_drop_host_view.cc
index ab55881611f0a8bf65904f434f487d3fbfc29203..317645e61183af257156ed5601d908b35e1b5673 100644
--- a/ui/views/animation/ink_drop_host_view.cc
+++ b/ui/views/animation/ink_drop_host_view.cc
@@ -5,6 +5,7 @@
#include "ui/views/animation/ink_drop_host_view.h"
#include "ui/gfx/color_palette.h"
+#include "ui/gfx/geometry/size_conversions.h"
#include "ui/views/animation/ink_drop_hover.h"
#include "ui/views/animation/square_ink_drop_animation.h"
@@ -14,6 +15,17 @@ namespace views {
const int kInkDropSize = 24;
const int kInkDropLargeCornerRadius = 4;
+// The scale factor to compute the large ink drop size.
+const float kLargeInkDropScale = 1.333f;
+
+namespace {
+
+gfx::Size CalculateLargeInkDropSize(const gfx::Size small_size) {
+ return gfx::ScaleToCeiledSize(gfx::Size(small_size), kLargeInkDropScale);
+}
+
+} // namespace
+
// static
const int InkDropHostView::kInkDropSmallCornerRadius = 2;
@@ -35,12 +47,10 @@ void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
}
scoped_ptr<InkDropAnimation> InkDropHostView::CreateInkDropAnimation() const {
- gfx::Size large_drop(ink_drop_size_.width() * 4 / 3,
- ink_drop_size_.height() * 4 / 3);
-
scoped_ptr<InkDropAnimation> animation(new SquareInkDropAnimation(
- large_drop, kInkDropLargeCornerRadius, ink_drop_size_,
- kInkDropSmallCornerRadius, GetInkDropCenter(), GetInkDropBaseColor()));
+ CalculateLargeInkDropSize(ink_drop_size_), kInkDropLargeCornerRadius,
+ ink_drop_size_, kInkDropSmallCornerRadius, GetInkDropCenter(),
+ GetInkDropBaseColor()));
return animation;
}
@@ -48,6 +58,7 @@ scoped_ptr<InkDropHover> InkDropHostView::CreateInkDropHover() const {
scoped_ptr<InkDropHover> hover(
new InkDropHover(ink_drop_size_, kInkDropSmallCornerRadius,
GetInkDropCenter(), GetInkDropBaseColor()));
+ hover->set_explode_size(CalculateLargeInkDropSize(ink_drop_size_));
return hover;
}
« no previous file with comments | « ui/views/animation/ink_drop_animation_controller_impl.cc ('k') | ui/views/animation/ink_drop_hover.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698