Skip to content

Commit

Permalink
Only invalidate layout if children layout is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
tarkah committed Apr 18, 2023
1 parent 07dfebf commit ac7b77f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lazy/src/responsive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ where
_renderer: &Renderer,
limits: &layout::Limits,
) -> layout::Node {
let _ = self.content.borrow_mut().layout.take();

layout::Node::new(limits.max())
}

Expand Down Expand Up @@ -186,7 +184,10 @@ where
let state = tree.state.downcast_mut::<State>();
let mut content = self.content.borrow_mut();

content.resolve(
let mut local_messages = vec![];
let mut local_shell = Shell::new(&mut local_messages);

let status = content.resolve(
&mut state.tree.borrow_mut(),
renderer,
layout,
Expand All @@ -199,10 +200,18 @@ where
cursor_position,
renderer,
clipboard,
shell,
&mut local_shell,
)
},
)
);

if local_shell.is_layout_invalid() {
let _ = content.layout.take();
}

shell.merge(local_shell, std::convert::identity);

status
}

fn draw(
Expand Down

0 comments on commit ac7b77f

Please sign in to comment.