提交 bdfedcc2 编写于 作者: M Michael Goderbauer 提交者: GitHub

Add overlaps method to Rect (#4150)

* Add overlaps method to Rect

* review comment
上级 a0313d10
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册