summaryrefslogtreecommitdiffstats
path: root/examples/modal
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-01-12 14:41:40 +0100
committerLibravatar GitHub <noreply@github.com>2024-01-12 14:41:40 +0100
commit50c310fd9f692eafb2350827636ffbd6d7b6c9b9 (patch)
tree0f1ab4182a0cce7469e01881c095e0c3988b3f9a /examples/modal
parent63e9adac56e9a4f21ec82137329d7c455fbf630b (diff)
parent11474bdc3e1a43e6c167d7b98f22d87933dbd2b6 (diff)
downloadiced-50c310fd9f692eafb2350827636ffbd6d7b6c9b9.tar.gz
iced-50c310fd9f692eafb2350827636ffbd6d7b6c9b9.tar.bz2
iced-50c310fd9f692eafb2350827636ffbd6d7b6c9b9.zip
Merge pull request #2192 from iced-rs/fix/layout-inconsistencies
Layout consistency
Diffstat (limited to 'examples/modal')
-rw-r--r--examples/modal/src/main.rs21
1 files changed, 7 insertions, 14 deletions
diff --git a/examples/modal/src/main.rs b/examples/modal/src/main.rs
index acb14372..631efe6e 100644
--- a/examples/modal/src/main.rs
+++ b/examples/modal/src/main.rs
@@ -281,12 +281,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(
@@ -420,17 +416,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(