diff options
Diffstat (limited to 'core/src/rectangle.rs')
-rw-r--r-- | core/src/rectangle.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index 2ab50137..fb66131a 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -227,3 +227,19 @@ where } } } + +impl<T> std::ops::Mul<Vector<T>> for Rectangle<T> +where + T: std::ops::Mul<Output = T> + Copy, +{ + type Output = Rectangle<T>; + + fn mul(self, scale: Vector<T>) -> Self { + Rectangle { + x: self.x * scale.x, + y: self.y * scale.y, + width: self.width * scale.x, + height: self.height * scale.y, + } + } +} |