From 6a731233c5c9b88e623a823b439a239a8a4d52da Mon Sep 17 00:00:00 2001 From: Julia Date: Tue, 21 Feb 2023 11:40:48 -0500 Subject: [PATCH] Remove `Flex::with_reversed_pain_order` --- crates/collab_ui/src/collab_titlebar_item.rs | 1 - crates/gpui/src/elements/flex.rs | 19 +------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs index 72e885b84e..48a1a0f263 100644 --- a/crates/collab_ui/src/collab_titlebar_item.rs +++ b/crates/collab_ui/src/collab_titlebar_item.rs @@ -628,7 +628,6 @@ impl CollabTitlebarItem { let content = Stack::new() .with_children(user.avatar.as_ref().map(|avatar| { let flex = Flex::row() - // .with_reversed_paint_order() .with_child(Self::render_face(avatar.clone(), avatar_style.clone())) .with_children( (|| { diff --git a/crates/gpui/src/elements/flex.rs b/crates/gpui/src/elements/flex.rs index 4e52032f67..ce595222f3 100644 --- a/crates/gpui/src/elements/flex.rs +++ b/crates/gpui/src/elements/flex.rs @@ -20,7 +20,6 @@ struct ScrollState { pub struct Flex { axis: Axis, - paint_reversed: bool, children: Vec, scroll_state: Option<(ElementStateHandle>, usize)>, } @@ -29,7 +28,6 @@ impl Flex { pub fn new(axis: Axis) -> Self { Self { axis, - paint_reversed: false, children: Default::default(), scroll_state: None, } @@ -43,11 +41,6 @@ impl Flex { Self::new(Axis::Vertical) } - pub fn with_reversed_paint_order(mut self) -> Self { - self.paint_reversed = true; - self - } - pub fn scrollable( mut self, element_id: usize, @@ -303,7 +296,7 @@ impl Element for Flex { } } - let mut child_action = |child: &mut ElementBox| { + for child in &mut self.children { if remaining_space > 0. { if let Some(metadata) = child.metadata::() { if metadata.float { @@ -322,16 +315,6 @@ impl Element for Flex { Axis::Horizontal => child_origin += vec2f(child.size().x(), 0.0), Axis::Vertical => child_origin += vec2f(0.0, child.size().y()), } - }; - - if self.paint_reversed { - for child in self.children.iter_mut().rev() { - child_action(child); - } - } else { - for child in &mut self.children { - child_action(child); - } } if overflowing {