From afa0bca4fd1a5499fd24549eb49a44f9837597c6 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 29 Apr 2020 08:25:27 +0200 Subject: Implement `Rectangle::position` --- core/src/rectangle.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core/src') 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 { 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 -- cgit