Trait suzy::dims::Rect[][src]

pub trait Rect {
    fn x(&self) -> Dim;
fn y(&self) -> Dim;
fn x_mut<F, R>(&mut self, f: F) -> R
    where
        F: FnOnce(&mut Dim) -> R
;
fn y_mut<F, R>(&mut self, f: F) -> R
    where
        F: FnOnce(&mut Dim) -> R
; fn left(&self) -> f32 { ... }
fn set_left(&mut self, value: f32) { ... }
fn right(&self) -> f32 { ... }
fn set_right(&mut self, value: f32) { ... }
fn bottom(&self) -> f32 { ... }
fn set_bottom(&mut self, value: f32) { ... }
fn top(&self) -> f32 { ... }
fn set_top(&mut self, value: f32) { ... }
fn center_x(&self) -> f32 { ... }
fn set_center_x(&mut self, value: f32) { ... }
fn center_y(&self) -> f32 { ... }
fn set_center_y(&mut self, value: f32) { ... }
fn center(&self) -> (f32, f32) { ... }
fn set_center(&mut self, value: (f32, f32)) { ... }
fn width(&self) -> f32 { ... }
fn set_width(&mut self, value: f32) { ... }
fn height(&self) -> f32 { ... }
fn set_height(&mut self, value: f32) { ... }
fn pivot(&self) -> (f32, f32) { ... }
fn set_pivot(&mut self, value: (f32, f32)) { ... }
fn pivot_pos(&self) -> (f32, f32) { ... }
fn set_pivot_pos(&mut self, value: (f32, f32)) { ... }
fn area(&self) -> f32 { ... }
fn aspect(&self) -> f32 { ... }
fn contains(&self, point: (f32, f32)) -> bool { ... }
fn set_fill_width<R: ?Sized>(&mut self, other: &R, padding: Padding)
    where
        R: Rect
, { ... }
fn set_fill_height<R: ?Sized>(&mut self, other: &R, padding: Padding)
    where
        R: Rect
, { ... }
fn set_fill<R: ?Sized, P: ?Sized>(&mut self, other: &R, padding: &P)
    where
        R: Rect,
        P: Padding2d
, { ... }
fn shrink_to_aspect(&mut self, aspect: f32) { ... }
fn grow_to_aspect(&mut self, aspect: f32) { ... }
fn surrounds<R: Rect + ?Sized>(&self, other: &R) -> bool { ... }
fn overlaps<R: Rect + ?Sized>(&self, other: &R) -> bool { ... } }

Methods associated with controlling the dimensions of a Rectangular visual element.

Required methods

fn x(&self) -> Dim[src]

Get the x dimension of the rectangle.

fn y(&self) -> Dim[src]

Get the y dimension of the rectangle.

fn x_mut<F, R>(&mut self, f: F) -> R where
    F: FnOnce(&mut Dim) -> R, 
[src]

Apply a transfomation to the x dimension of the rectangle.

fn y_mut<F, R>(&mut self, f: F) -> R where
    F: FnOnce(&mut Dim) -> R, 
[src]

Apply a transfomation to the y dimension of the rectangle.

Loading content...

Provided methods

fn left(&self) -> f32[src]

Get the left edge of the rectangle

fn set_left(&mut self, value: f32)[src]

Set the left edge of the rect and for it to grow to the right

fn right(&self) -> f32[src]

Get the right edge of the rectangle

fn set_right(&mut self, value: f32)[src]

Set the right edge of the rect and for it to grow to the left

fn bottom(&self) -> f32[src]

Get the bottom edge of the rectangle

fn set_bottom(&mut self, value: f32)[src]

Set the bottom edge of the rect and for it to grow upwards

fn top(&self) -> f32[src]

Get the top edge of the rectangle

fn set_top(&mut self, value: f32)[src]

Set the top edge of the rect and for it to grow downwards

fn center_x(&self) -> f32[src]

Get the horizontal center of the rect

fn set_center_x(&mut self, value: f32)[src]

Set the horizontal center of the rect and for it to grow evenly wider

fn center_y(&self) -> f32[src]

Get the vertical center of the rect

fn set_center_y(&mut self, value: f32)[src]

Set the vertical center of the rect and for it to grow evenly taller

fn center(&self) -> (f32, f32)[src]

Get the center of the rect

fn set_center(&mut self, value: (f32, f32))[src]

Set the center of the rect and for it to grow evenly outwards

fn width(&self) -> f32[src]

Get the width of the rectangle

fn set_width(&mut self, value: f32)[src]

Set the width of the rectangle

fn height(&self) -> f32[src]

Get the height of the rectangle

fn set_height(&mut self, value: f32)[src]

Set the height of the rectangle

fn pivot(&self) -> (f32, f32)[src]

Set the pivot. A pivot of (0.5, 0.5) indicates that a rect will grow from it’s center, whereas a pivot of (0, 0) indicates that a rect will grow from it’s bottom left corner.

fn set_pivot(&mut self, value: (f32, f32))[src]

Set the pivot. A pivot of (0.5, 0.5) indicates that a rect will grow from it’s center, whereas a pivot of (0, 0) indicates that a rect will grow from it’s bottom left corner.

fn pivot_pos(&self) -> (f32, f32)[src]

Get the global position of the pivot of the rectangle

fn set_pivot_pos(&mut self, value: (f32, f32))[src]

Set the global position of the pivot of the rectangle

fn area(&self) -> f32[src]

Get the area of the rectangle

fn aspect(&self) -> f32[src]

Get the aspect ratio of this rectangle (width / height) Note: this may be a non-normal number

fn contains(&self, point: (f32, f32)) -> bool[src]

Check if a point is inside the rectangle

fn set_fill_width<R: ?Sized>(&mut self, other: &R, padding: Padding) where
    R: Rect
[src]

Calculate the width and horizontal position of this rect based on another rect and some padding

fn set_fill_height<R: ?Sized>(&mut self, other: &R, padding: Padding) where
    R: Rect
[src]

Calculate the height and vertical position of this rect based on another rect and some padding

fn set_fill<R: ?Sized, P: ?Sized>(&mut self, other: &R, padding: &P) where
    R: Rect,
    P: Padding2d
[src]

Calculate the size and position of this rect based on another rect and some padding

fn shrink_to_aspect(&mut self, aspect: f32)[src]

Shink one of the lengths of this rect so that the rect’s aspect ratio becomes the one provided

fn grow_to_aspect(&mut self, aspect: f32)[src]

Expand one of the lengths of this rect so that the rect’s aspect ratio becomes the one provided

fn surrounds<R: Rect + ?Sized>(&self, other: &R) -> bool[src]

Check if another rect is completely contained within this one

fn overlaps<R: Rect + ?Sized>(&self, other: &R) -> bool[src]

Check if this rect overlaps at all with another

Loading content...

Implementors

impl Rect for &mut WidgetRect[src]

impl Rect for SelectableSlicedImage[src]

impl Rect for SlicedImage[src]

impl Rect for WidgetExtra<'_>[src]

impl Rect for WidgetRect[src]

impl Rect for dyn DynRect[src]

impl<'a> Rect for FixedSizeRect[src]

impl<'a> Rect for SimpleRect[src]

impl<'a, T: ?Sized> Rect for ContentRef<'a, T>[src]

impl<P: RenderPlatform> Rect for dyn AnonWidget<P>[src]

impl<P: ?Sized, T> Rect for Widget<T, P> where
    P: RenderPlatform,
    T: WidgetContent<P>, 
[src]

impl<T: Rect + ?Sized> Rect for Masker<T>[src]

Loading content...