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

Unified Diff: ui/gfx/geometry/rect.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: Moved InkDropHostView::AsLocatedEvent() to event_utils.(h|cc) as ToLocatedEventOrNull(). 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/gfx/geometry/rect.cc
diff --git a/ui/gfx/geometry/rect.cc b/ui/gfx/geometry/rect.cc
index e7a3aa2aac93f14eb96c4832a130f4bbeafa9253..b7bdc3947d57f14d6dd168adbe4cd5867d982d49 100644
--- a/ui/gfx/geometry/rect.cc
+++ b/ui/gfx/geometry/rect.cc
@@ -239,6 +239,19 @@ int Rect::ManhattanInternalDistance(const Rect& rect) const {
return x + y;
}
+float Rect::MaxDistanceToCorners(const gfx::Point& point) const {
+ const float distance_to_top_left = (origin() - point).Length();
+ const float distance_to_top_right = (top_right() - point).Length();
+ const float distance_to_bottom_left = (bottom_left() - point).Length();
+ const float distance_to_bottom_right = (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;
+}
+
std::string Rect::ToString() const {
return base::StringPrintf("%s %s",
origin().ToString().c_str(),

Powered by Google App Engine
This is Rietveld 408576698