summaryrefslogtreecommitdiffstats
path: root/native/src/widget/container.rs
diff options
context:
space:
mode:
authorLibravatar Cory Forsstrom <cforsstrom18@gmail.com>2022-10-27 11:48:42 -0700
committerLibravatar Cory Forsstrom <cforsstrom18@gmail.com>2022-10-27 11:50:12 -0700
commit2c103f8654943c773b6de3c70eb2927e92219422 (patch)
treeeda48510b5a8530367297dc87d04302d6b3ed4b8 /native/src/widget/container.rs
parent82217947aa80287282ed6deb02d238a31303e0d6 (diff)
downloadiced-2c103f8654943c773b6de3c70eb2927e92219422.tar.gz
iced-2c103f8654943c773b6de3c70eb2927e92219422.tar.bz2
iced-2c103f8654943c773b6de3c70eb2927e92219422.zip
Constrain padding to inner & outer sizes
Diffstat (limited to 'native/src/widget/container.rs')
-rw-r--r--native/src/widget/container.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/native/src/widget/container.rs b/native/src/widget/container.rs
index 2afad3f2..cc886dcb 100644
--- a/native/src/widget/container.rs
+++ b/native/src/widget/container.rs
@@ -293,11 +293,13 @@ pub fn layout<Renderer>(
.max_width(max_width)
.max_height(max_height)
.width(width)
- .height(height)
- .pad(padding);
+ .height(height);
- let mut content = layout_content(renderer, &limits.loose());
- let size = limits.resolve(content.size());
+ let mut content = layout_content(renderer, &limits.pad(padding).loose());
+
+ let padding = padding.constrain(content.size(), limits.max());
+
+ let size = limits.pad(padding).resolve(content.size());
content.move_to(Point::new(padding.left.into(), padding.top.into()));
content.align(