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

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

Issue 2042073002: Centered flood fill style ink drop ripples on mouse/touch points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed LocatedEvent::AsLocatedIfLocatedEvent() as FromIfValid(). Created 4 years, 6 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/flood_fill_ink_drop_ripple.cc
diff --git a/ui/views/animation/flood_fill_ink_drop_ripple.cc b/ui/views/animation/flood_fill_ink_drop_ripple.cc
index 9abd3e750fe62bcd8dea0c0b42de1cef5aea5a55..3d376009d325b7dedeb89db8c2e6fc61b57e485f 100644
--- a/ui/views/animation/flood_fill_ink_drop_ripple.cc
+++ b/ui/views/animation/flood_fill_ink_drop_ripple.cc
@@ -316,12 +316,23 @@ gfx::Transform FloodFillInkDropRipple::CalculateTransform(
}
gfx::Transform FloodFillInkDropRipple::GetMaxSizeTargetTransform() const {
- // TODO(estade): get rid of this 2, but make the fade out start before the
- // active/action transform is done.
- return CalculateTransform(gfx::Vector2dF(root_layer_.bounds().width(),
- root_layer_.bounds().height())
- .Length() /
- 2);
+ return CalculateTransform(MaxDistanceToCorners(center_point_));
+}
+
+float FloodFillInkDropRipple::MaxDistanceToCorners(
+ const gfx::Point& point) const {
+ const gfx::Rect bounds = root_layer_.bounds();
+ const float distance_to_top_left = (bounds.origin() - point).Length();
+ const float distance_to_top_right = (bounds.top_right() - point).Length();
+ const float distance_to_bottom_left = (bounds.bottom_left() - point).Length();
+ const float distance_to_bottom_right =
+ (bounds.bottom_right() - point).Length();
+
+ float largest_distance =
+ std::max(distance_to_top_left, distance_to_top_right);
+ largest_distance = std::max(largest_distance, distance_to_bottom_left);
+ largest_distance = std::max(largest_distance, distance_to_bottom_right);
+ return largest_distance;
}
} // namespace views
« no previous file with comments | « ui/views/animation/flood_fill_ink_drop_ripple.h ('k') | ui/views/animation/flood_fill_ink_drop_ripple_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698