summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/vector.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/src/vector.rs b/core/src/vector.rs
index a75053a0..def3f8c0 100644
--- a/core/src/vector.rs
+++ b/core/src/vector.rs
@@ -43,6 +43,17 @@ where
}
}
+impl<T> std::ops::Mul<T> for Vector<T>
+where
+ T: std::ops::Mul<Output = T> + Copy,
+{
+ type Output = Self;
+
+ fn mul(self, scale: T) -> Self {
+ Self::new(self.x * scale, self.y * scale)
+ }
+}
+
impl<T> Default for Vector<T>
where
T: Default,