diff options
author | 2020-04-29 08:25:27 +0200 | |
---|---|---|
committer | 2020-04-29 08:25:27 +0200 | |
commit | afa0bca4fd1a5499fd24549eb49a44f9837597c6 (patch) | |
tree | 38f52a04e88775edc88e53efd6d3f7488cd257c2 /core | |
parent | 61c707fe044e7abc035f1a35697757f55f955417 (diff) | |
download | iced-afa0bca4fd1a5499fd24549eb49a44f9837597c6.tar.gz iced-afa0bca4fd1a5499fd24549eb49a44f9837597c6.tar.bz2 iced-afa0bca4fd1a5499fd24549eb49a44f9837597c6.zip |
Implement `Rectangle::position`
Diffstat (limited to 'core')
-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 |