Introduce visible_bounds operation for Container

This commit is contained in:
Héctor Ramón Jiménez 2023-07-27 01:02:28 +02:00
parent e29754f32d
commit e2ba7ece83
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
16 changed files with 201 additions and 25 deletions

View file

@ -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
}
}
}