Add overlaps method to Rect (flutter/engine#4150)

* Add overlaps method to Rect

* review comment
This commit is contained in:
Michael Goderbauer
2017-09-27 17:42:44 -07:00
committed by GitHub
parent 80b35ebe57
commit c1441946b1

View File

@@ -653,6 +653,15 @@ class Rect {
);
}
/// Whether `other` has a nonzero area of overlap with this rectangle.
bool overlaps(Rect other) {
if (right <= other.left || other.right <= left)
return false;
if (bottom <= other.top || other.bottom <= top)
return false;
return true;
}
/// The lesser of the magnitudes of the width and the height of this
/// rectangle.
double get shortestSide {