summaryrefslogtreecommitdiffstats
path: root/core/src/rectangle.rs
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/rectangle.rs')
-rw-r--r--core/src/rectangle.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs
index 95c2570c..c3191677 100644
--- a/core/src/rectangle.rs
+++ b/core/src/rectangle.rs
@@ -28,3 +28,16 @@ impl Rectangle<f32> {
&& point.y <= self.y + self.height
}
}
+
+impl std::ops::Mul<f32> for Rectangle<u32> {
+ type Output = Self;
+
+ fn mul(self, scale: f32) -> Self {
+ Self {
+ x: (self.x as f32 * scale).round() as u32,
+ y: (self.y as f32 * scale).round() as u32,
+ width: (self.width as f32 * scale).round() as u32,
+ height: (self.height as f32 * scale).round() as u32,
+ }
+ }
+}