Struct layout2d::rect::Rect
[−]
[src]
pub struct Rect<T: Clone> { pub x: [f32; 4], pub y: [f32; 4], pub z: f32, pub data: NodeData<T>, }
A finite rectangle in pixel coordinates that will end up on the screen
Fields
x: [f32; 4]
x coordinates - as an array because of simd layout tl, tr, bl, br
y: [f32; 4]
y coordinates - as an array because of simd layout tl, tr, bl, br
z: f32
Z-index is an int in order to achieve z-order sortability
data: NodeData<T>
Internal data of the rectangle
Methods
impl<T: Clone> Rect<T>
[src]
fn new(
top: f32,
bottom: f32,
left: f32,
right: f32,
z: f32,
data: NodeData<T>
) -> Self
[src]
top: f32,
bottom: f32,
left: f32,
right: f32,
z: f32,
data: NodeData<T>
) -> Self
Creates a new rectangle
fn new_wh(
offset_left: f32,
offset_top: f32,
width: f32,
height: f32,
z: f32,
data: NodeData<T>
) -> Self
[src]
offset_left: f32,
offset_top: f32,
width: f32,
height: f32,
z: f32,
data: NodeData<T>
) -> Self
Creates a new rectangle with width / height instead of top / bottom
fn rotate_center(&mut self, in_angle: f32)
[src]
fn translate(&mut self, x: f32, y: f32)
[src]
fn set_width(&mut self, width: f32)
[src]
Set width from top left corner Warning: may not work well after rotations
fn set_height(&mut self, height: f32)
[src]
Set height from top left corner Warning: may not work well after rotations
Trait Implementations
impl<T: Debug + Clone> Debug for Rect<T>
[src]
impl<T: Clone + Clone> Clone for Rect<T>
[src]
fn clone(&self) -> Rect<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more