diff --git a/src/util.rs b/src/util.rs index bfc5fc2..c052b1b 100644 --- a/src/util.rs +++ b/src/util.rs @@ -123,6 +123,13 @@ mod size { (self.width, self.height) } + pub fn clamp(self, other: Self) -> Self { + Self::new( + self.width.min(other.width), + self.height.min(other.height), + ) + } + pub fn map(self, f: F) -> Self where F: FnOnce(I, I) -> Self,