Trait suzy::dims::DynRect[][src]

pub trait DynRect {
    fn x(&self) -> Dim;
fn y(&self) -> Dim;
fn x_mut<'a>(&mut self, f: Box<dyn FnOnce(&mut Dim) + 'a>);
fn y_mut<'a>(&mut self, f: Box<dyn FnOnce(&mut Dim) + 'a>);
fn set_left(&mut self, value: f32);
fn set_right(&mut self, value: f32);
fn set_bottom(&mut self, value: f32);
fn set_top(&mut self, value: f32);
fn set_center_x(&mut self, value: f32);
fn set_center_y(&mut self, value: f32);
fn set_center(&mut self, value: (f32, f32));
fn set_width(&mut self, value: f32);
fn set_height(&mut self, value: f32);
fn set_pivot(&mut self, value: (f32, f32));
fn set_pivot_pos(&mut self, value: (f32, f32));
fn shrink_to_aspect(&mut self, aspect: f32);
fn grow_to_aspect(&mut self, aspect: f32); }

An object-safe version of the Rect trait

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<'a>(&mut self, f: Box<dyn FnOnce(&mut Dim) + 'a>)[src]

Apply a transfomation to the x dimension of the rectangle.

fn y_mut<'a>(&mut self, f: Box<dyn FnOnce(&mut Dim) + 'a>)[src]

Apply a transfomation to the y dimension 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 set_right(&mut self, value: f32)[src]

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

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

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

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

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

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

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

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

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

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

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

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

Set the width of the rectangle

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

Set the height of the rectangle

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 set_pivot_pos(&mut self, value: (f32, f32))[src]

Set the global position of the pivot of the rectangle

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

Loading content...

Trait Implementations

impl Rect for dyn DynRect[src]

Implementors

impl<T: Rect> DynRect for T[src]

Loading content...