Implement Rectangle::position

This commit is contained in:
Héctor Ramón Jiménez 2020-04-29 08:25:27 +02:00
parent 61c707fe04
commit afa0bca4fd

View File

@ -72,6 +72,13 @@ impl Rectangle<f32> {
self.y + self.height / 2.0
}
/// Returns the position of the top left corner of the [`Rectangle`].
///
/// [`Rectangle`]: struct.Rectangle.html
pub fn position(&self) -> Point {
Point::new(self.x, self.y)
}
/// Returns the [`Size`] of the [`Rectangle`].
///
/// [`Size`]: struct.Size.html