Draft Program interactivity for Canvas
This commit is contained in:
parent
90c3a183d5
commit
0b5028b1ab
9 changed files with 112 additions and 36 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue