diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index b9d0d5d2..87046df4 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -1,4 +1,4 @@ -use crate::{Point, Size}; +use crate::{Point, Size, Vector}; /// A rectangle. #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] @@ -140,3 +140,18 @@ impl From> for Rectangle { } } } + +impl std::ops::Add> for Rectangle +where + T: std::ops::Add, +{ + type Output = Rectangle; + + fn add(self, translation: Vector) -> Self { + Rectangle { + x: self.x + translation.x, + y: self.y + translation.y, + ..self + } + } +}