Struct layout2d::rect::Rect
[−]
[src]
pub struct Rect<T: Copy + 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 top left, top right, bottom left, bottom right
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: Copy + Clone> Rect<T>
[src]
fn new(
top: f32,
bottom: f32,
left: f32,
right: f32,
z: f32,
data: NodeData<T>
) -> Self
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
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)
fn translate(&mut self, x: f32, y: f32)
fn set_width(&mut self, width: f32)
Set width from top left corner Warning: may not work well after rotations
fn set_height(&mut self, height: f32)
Set height from top left corner Warning: may not work well after rotations