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

Unified Diff: sky/engine/core/painting/Rect.dart

Issue 1216013003: Fix the floating action button. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | sky/sdk/lib/painting/box_painter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | sky/sdk/lib/painting/box_painter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698