Index: sky/engine/core/painting/Rect.dart |
diff --git a/sky/engine/core/painting/Rect.dart b/sky/engine/core/painting/Rect.dart |
index ee1eb6a31513ddfff0fd98a43bbb23fb20a2693f..85fe07331e05b24ac4583377b91de6b21ba90b5b 100644 |
--- a/sky/engine/core/painting/Rect.dart |
+++ b/sky/engine/core/painting/Rect.dart |
@@ -30,14 +30,23 @@ class Rect { |
double get right => _value[2]; |
double get bottom => _value[3]; |
- Point get center => new Point(left + right / 2.0, top + bottom / 2.0); |
+ double get width => right - left; |
+ double get height => bottom - top; |
+ |
+ Size get size => new Size(width, height); |
+ |
+ double get shortestSide { |
+ double w = width.abs(); |
+ double h = height.abs(); |
+ return w < h ? w : h; |
+ } |
+ |
+ Point get center => new Point(left + width / 2.0, top + height / 2.0); |
Point get topLeft => new Point(left, top); |
Point get topRight => new Point(right, top); |
Point get bottomLeft => new Point(left, bottom); |
Point get bottomRight => new Point(right, bottom); |
- Size get size => new Size(right - left, bottom - top); |
- |
// Rects are inclusive of the top and left edges but exclusive of the bottom |
// right edges. |
bool contains(Point point) { |