diff options
author | 2024-01-16 12:02:42 +0100 | |
---|---|---|
committer | 2024-01-16 12:02:42 +0100 | |
commit | 534c7dd7b0bc515c31b6de87b4aa6a35b44c46a0 (patch) | |
tree | 0ddc8f1b681cbade7e47293bd46a362896aa538a /examples/modal | |
parent | 17135cbd56316f31167eb62e026839450506573f (diff) | |
parent | c4ba657de86d7606587dad5124f435141258f570 (diff) | |
download | iced-534c7dd7b0bc515c31b6de87b4aa6a35b44c46a0.tar.gz iced-534c7dd7b0bc515c31b6de87b4aa6a35b44c46a0.tar.bz2 iced-534c7dd7b0bc515c31b6de87b4aa6a35b44c46a0.zip |
Merge branch 'master' into update-winit
Diffstat (limited to 'examples/modal')
-rw-r--r-- | examples/modal/src/main.rs | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/examples/modal/src/main.rs b/examples/modal/src/main.rs index 05461dab..d1cc7bb0 100644 --- a/examples/modal/src/main.rs +++ b/examples/modal/src/main.rs @@ -282,12 +282,8 @@ mod modal { tree.diff_children(&[&self.base, &self.modal]); } - fn width(&self) -> Length { - self.base.as_widget().width() - } - - fn height(&self) -> Length { - self.base.as_widget().height() + fn size(&self) -> Size<Length> { + self.base.as_widget().size() } fn layout( @@ -421,17 +417,14 @@ mod modal { .width(Length::Fill) .height(Length::Fill); - let mut child = self + let child = self .content .as_widget() - .layout(self.tree, renderer, &limits); - - child.align(Alignment::Center, Alignment::Center, limits.max()); - - let mut node = layout::Node::with_children(self.size, vec![child]); - node.move_to(position); + .layout(self.tree, renderer, &limits) + .align(Alignment::Center, Alignment::Center, limits.max()); - node + layout::Node::with_children(self.size, vec![child]) + .move_to(position) } fn on_event( |