Add overlaps method to Rect (flutter/engine#4150)
* Add overlaps method to Rect * review comment
This commit is contained in:
committed by
GitHub
parent
80b35ebe57
commit
c1441946b1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user