diff options
Diffstat (limited to 'core/src/rectangle.rs')
-rw-r--r-- | core/src/rectangle.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index 7ff324cb..db56aa18 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -197,3 +197,18 @@ where } } } + +impl<T> std::ops::Sub<Vector<T>> for Rectangle<T> +where + T: std::ops::Sub<Output = T>, +{ + type Output = Rectangle<T>; + + fn sub(self, translation: Vector<T>) -> Self { + Rectangle { + x: self.x - translation.x, + y: self.y - translation.y, + ..self + } + } +} |