pub fn justify_or_align(self, mut rect: Rect, child_size: Vec2) -> Rect {
        if self.main_dir.is_horizontal() {
            debug_assert!((rect.width() - child_size.x).abs() < 0.1);
            if self.cross_justify {
                rect // fill full height
            } else {
                rect.min.y += match self.cross_align {
                    Align::Min => 0.0,
                    Align::Center => 0.5 * (rect.size().y - child_size.y),
                    Align::Max => rect.size().y - child_size.y,
                };
                rect.max.y = rect.min.y + child_size.y;
                rect
            }
        } else {
            debug_assert!((rect.height() - child_size.y).abs() < 0.1);
            if self.cross_justify {
                rect // justified: fill full width
            } else {
                rect.min.x += match self.cross_align {
                    Align::Min => 0.0,
                    Align::Center => 0.5 * (rect.size().x - child_size.x),
                    Align::Max => rect.size().x - child_size.x,
                };
                rect.max.x = rect.min.x + child_size.x;
                rect
            }
        }
    }
/// Apply justify or alignment after calling `next_space`.
Apply justify or alignment after calling `next_space`.
Apply justify or alignment after calling ` next_space ` .
pub fn justify_or_align(self, mut rect: Rect, child_size: Vec2) -> Rect {
        if self.main_dir.is_horizontal() {
            debug_assert!((rect.width() - child_size.x).abs() < 0.1);
            if self.cross_justify {
                rect // fill full height
            } else {
                rect.min.y += match self.cross_align {
                    Align::Min => 0.0,
                    Align::Center => 0.5 * (rect.size().y - child_size.y),
                    Align::Max => rect.size().y - child_size.y,
                };
                rect.max.y = rect.min.y + child_size.y;
                rect
            }
        } else {
            debug_assert!((rect.height() - child_size.y).abs() < 0.1);
            if self.cross_justify {
                rect // justified: fill full width
            } else {
                rect.min.x += match self.cross_align {
                    Align::Min => 0.0,
                    Align::Center => 0.5 * (rect.size().x - child_size.x),
                    Align::Max => rect.size().x - child_size.x,
                };
                rect.max.x = rect.min.x + child_size.x;
                rect
            }
        }
    }
pub fn justify_or_align ( self , mut rect : Rect , child_size : Vec2 ) -> Rect { if self . main_dir . is_horizontal ( ) { debug_assert ! ( ( rect width ( ) child_size x ) abs ( ) 0.1 ) ; if self . cross_justify { rect // fill full height } else { rect . min . y += match self . cross_align { Align :: Min => 0.0 , Align :: Center => 0.5 * ( rect . size ( ) . y - child_size . y ) , Align :: Max => rect . size ( ) . y - child_size . y , } ; rect . max . y = rect . min . y + child_size . y ; rect } } else { debug_assert ! ( ( rect height ( ) child_size y ) abs ( ) 0.1 ) ; if self . cross_justify { rect // justified: fill full width } else { rect . min . x += match self . cross_align { Align :: Min => 0.0 , Align :: Center => 0.5 * ( rect . size ( ) . x - child_size . x ) , Align :: Max => rect . size ( ) . x - child_size . x , } ; rect . max . x = rect . min . x + child_size . x ; rect } } }
Apply justify or alignment after calling `next_space`.
Apply justify or alignment after calling ` next_space ` .
self
rect
Rect
child_size
Vec2
self
rect
Rect
child_size
Vec2