diff --git a/src/rect.rs b/src/rect.rs index 776f0e0..1922d38 100644 --- a/src/rect.rs +++ b/src/rect.rs @@ -115,6 +115,11 @@ impl + Sub> Rect { size: Size2D(self.size.width + width + width, self.size.height + height + height), } } + + #[inline] + pub fn translate_by_size(&self, size: &Size2D) -> Rect { + Rect(Point2D(self.origin.x + size.width, self.origin.y + size.height), self.size.clone()) + } } impl> Rect {