summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/point.rs8
-rw-r--r--core/src/rectangle.rs6
2 files changed, 14 insertions, 0 deletions
diff --git a/core/src/point.rs b/core/src/point.rs
index 9bf7726b..d351befd 100644
--- a/core/src/point.rs
+++ b/core/src/point.rs
@@ -75,3 +75,11 @@ impl std::ops::Sub<Point> for Point {
Vector::new(self.x - point.x, self.y - point.y)
}
}
+
+impl std::ops::Add<Point> for Point {
+ type Output = Point;
+
+ fn add(self, point: Point) -> Point {
+ Point::new(self.x + point.x, self.y + point.y)
+ }
+}
diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs
index 4fe91519..c6e6fce4 100644
--- a/core/src/rectangle.rs
+++ b/core/src/rectangle.rs
@@ -111,6 +111,12 @@ impl Rectangle<f32> {
}
}
+impl std::cmp::PartialOrd for Rectangle<f32> {
+ fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
+ (self.width * self.height).partial_cmp(&(other.width * other.height))
+ }
+}
+
impl std::ops::Mul<f32> for Rectangle<f32> {
type Output = Self;