diff options
| author | 2020-04-19 14:39:30 +0200 | |
|---|---|---|
| committer | 2020-04-19 14:39:30 +0200 | |
| commit | 0b5028b1ab47707a469176e9bf20cacdd3a19861 (patch) | |
| tree | ba4ea88bbb5e3d3ebf22699a758c30181f535b35 /core | |
| parent | 90c3a183d5e79aee1f323991c8c45161ccf9e187 (diff) | |
| download | iced-0b5028b1ab47707a469176e9bf20cacdd3a19861.tar.gz iced-0b5028b1ab47707a469176e9bf20cacdd3a19861.tar.bz2 iced-0b5028b1ab47707a469176e9bf20cacdd3a19861.zip  | |
Draft `Program` interactivity for `Canvas`
Diffstat (limited to '')
| -rw-r--r-- | core/src/rectangle.rs | 10 | 
1 files changed, 9 insertions, 1 deletions
diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index aead6e9a..db8ebfc8 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -1,4 +1,4 @@ -use crate::Point; +use crate::{Point, Size};  /// A rectangle.  #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] @@ -43,6 +43,14 @@ impl Rectangle<f32> {          self.y + self.height / 2.0      } +    /// Returns the [`Size`] of the [`Rectangle`]. +    /// +    /// [`Size`]: struct.Size.html +    /// [`Rectangle`]: struct.Rectangle.html +    pub fn size(&self) -> Size { +        Size::new(self.width, self.height) +    } +      /// Returns true if the given [`Point`] is contained in the [`Rectangle`].      ///      /// [`Point`]: struct.Point.html  | 
