diff options
-rw-r--r-- | core/src/rectangle.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index 6f953137..8bc89a44 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -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 |