Struct me3_framework::overlay::Align2
source · [−]Expand description
Two-dimension alignment, e.g. Align2::LEFT_TOP
.
Tuple Fields
0: [Align; 2]
Implementations
sourceimpl Align2
impl Align2
pub const LEFT_BOTTOM: Align2 = Align2([Align::Min, Align::Max])
pub const LEFT_CENTER: Align2 = Align2([Align::Min, Align::Center])
pub const LEFT_TOP: Align2 = Align2([Align::Min, Align::Min])
pub const CENTER_BOTTOM: Align2 = Align2([Align::Center, Align::Max])
pub const CENTER_CENTER: Align2 = Align2([Align::Center, Align::Center])
pub const CENTER_TOP: Align2 = Align2([Align::Center, Align::Min])
pub const RIGHT_BOTTOM: Align2 = Align2([Align::Max, Align::Max])
pub const RIGHT_CENTER: Align2 = Align2([Align::Max, Align::Center])
pub const RIGHT_TOP: Align2 = Align2([Align::Max, Align::Min])
sourceimpl Align2
impl Align2
sourcepub fn anchor_rect(self, rect: Rect) -> Rect
pub fn anchor_rect(self, rect: Rect) -> Rect
Used e.g. to anchor a piece of text to a part of the rectangle. Give a position within the rect, specified by the aligns
sourcepub fn align_size_within_rect(self, size: Vec2, frame: Rect) -> Rect
pub fn align_size_within_rect(self, size: Vec2, frame: Rect) -> Rect
e.g. center a size within a given frame
sourcepub fn pos_in_rect(self, frame: &Rect) -> Pos2
pub fn pos_in_rect(self, frame: &Rect) -> Pos2
Returns the point on the rect’s frame or in the center of a rect according to the alignments of this object.
(*)-----------+------(*)------+-----------(*)--> X
| | | |
| Min, Min | Center, Min | Max, Min |
| | | |
+------------+---------------+------------+
| | | |
(*)Min, Center|Center(*)Center|Max, Center(*)
| | | |
+------------+---------------+------------+
| | | |
| Min, Max | Center, Max | Max, Max |
| | | |
(*)-----------+------(*)------+-----------(*)
|
Y
Trait Implementations
impl Copy for Align2
impl Eq for Align2
impl StructuralEq for Align2
impl StructuralPartialEq for Align2
Auto Trait Implementations
impl RefUnwindSafe for Align2
impl Send for Align2
impl Sync for Align2
impl Unpin for Align2
impl UnwindSafe for Align2
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more