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

Unified Diff: packages/charted/lib/core/utils/rect.dart

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years 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
Index: packages/charted/lib/core/utils/rect.dart
diff --git a/packages/charted/lib/core/utils/rect.dart b/packages/charted/lib/core/utils/rect.dart
index 628a4b5d922c3e94b979045d7545f9bf5ba53a24..3e666ee0452849db2a7b3a80cabdcea555958265 100644
--- a/packages/charted/lib/core/utils/rect.dart
+++ b/packages/charted/lib/core/utils/rect.dart
@@ -16,11 +16,12 @@ class Rect {
final num height;
const Rect([this.x = 0, this.y = 0, this.width = 0, this.height = 0]);
- const Rect.size(this.width, this.height) : x = 0, y = 0;
- const Rect.position(this.x, this.y) : width = 0, height = 0;
-
- bool operator==(other) =>
- other is Rect && isSameSizeAs(other) && isSamePositionAs(other);
+ const Rect.size(this.width, this.height)
+ : x = 0,
+ y = 0;
+ const Rect.position(this.x, this.y)
+ : width = 0,
+ height = 0;
bool isSameSizeAs(Rect other) =>
other != null && width == other.width && height == other.height;
@@ -29,10 +30,16 @@ class Rect {
other != null && x == other.x && y == other.y;
bool contains(num otherX, num otherY) =>
- otherX >= x && otherX <= x + width &&
- otherY >= y && otherY <= y + height;
+ otherX >= x && otherX <= x + width && otherY >= y && otherY <= y + height;
String toString() => '$x, $y, $width, $height';
+
+ @override
+ bool operator ==(other) =>
+ other is Rect && isSameSizeAs(other) && isSamePositionAs(other);
+
+ @override
+ int get hashCode => hash4(x, y, width, height);
}
/// Mutable version of [Rect] class.
@@ -55,8 +62,13 @@ class AbsoluteRect {
const AbsoluteRect(this.top, this.end, this.bottom, this.start);
- bool operator==(other) =>
- other is AbsoluteRect &&
- start == other.start && end == other.end &&
- top == other.top && bottom == other.bottom;
-}
+ @override
+ bool operator ==(other) => other is AbsoluteRect &&
+ start == other.start &&
+ end == other.end &&
+ top == other.top &&
+ bottom == other.bottom;
+
+ @override
+ int get hashCode => hash4(start, end, top, bottom);
+}
« no previous file with comments | « packages/charted/lib/core/utils/object_factory.dart ('k') | packages/charted/lib/layout/src/hierarchy_layout.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698