mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Add Rect::offset
This commit is contained in:
parent
5d3c0d3fb0
commit
e23a5cd3a2
@ -79,6 +79,13 @@ impl Rect {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Adds the given offset to this rectangle.
|
||||||
|
pub fn offset<V>(&mut self, offset: V) where V: Into<Vec2> {
|
||||||
|
let offset = offset.into();
|
||||||
|
self.top_left = self.top_left + offset;
|
||||||
|
self.bottom_right = self.bottom_right + offset;
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the size of the rectangle.
|
/// Returns the size of the rectangle.
|
||||||
pub fn size(self) -> Vec2 {
|
pub fn size(self) -> Vec2 {
|
||||||
self.bottom_right - self.top_left + (1, 1)
|
self.bottom_right - self.top_left + (1, 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user