summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--native/src/widget/container.rs12
-rw-r--r--native/src/widget/scrollable.rs4
-rw-r--r--pure/src/widget/container.rs2
-rw-r--r--pure/src/widget/scrollable.rs1
4 files changed, 17 insertions, 2 deletions
diff --git a/native/src/widget/container.rs b/native/src/widget/container.rs
index 493aa67b..3d68a595 100644
--- a/native/src/widget/container.rs
+++ b/native/src/widget/container.rs
@@ -127,12 +127,20 @@ pub fn layout<Renderer>(
limits: &layout::Limits,
width: Length,
height: Length,
+ max_width: u32,
+ max_height: u32,
padding: Padding,
horizontal_alignment: alignment::Horizontal,
vertical_alignment: alignment::Vertical,
layout_content: impl FnOnce(&Renderer, &layout::Limits) -> layout::Node,
) -> layout::Node {
- let limits = limits.loose().width(width).height(height).pad(padding);
+ let limits = limits
+ .loose()
+ .max_width(max_width)
+ .max_height(max_height)
+ .width(width)
+ .height(height)
+ .pad(padding);
let mut content = layout_content(renderer, &limits.loose());
let size = limits.resolve(content.size());
@@ -171,6 +179,8 @@ where
limits,
self.width,
self.height,
+ self.max_width,
+ self.max_height,
self.padding,
self.horizontal_alignment,
self.vertical_alignment,
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs
index 1b255860..77ed2066 100644
--- a/native/src/widget/scrollable.rs
+++ b/native/src/widget/scrollable.rs
@@ -162,9 +162,10 @@ pub fn layout<Renderer>(
limits: &layout::Limits,
width: Length,
height: Length,
+ max_height: u32,
layout_content: impl FnOnce(&Renderer, &layout::Limits) -> layout::Node,
) -> layout::Node {
- let limits = limits.width(width).height(height);
+ let limits = limits.max_height(max_height).width(width).height(height);
let child_limits = layout::Limits::new(
Size::new(limits.min().width, 0.0),
@@ -648,6 +649,7 @@ where
limits,
Widget::<Message, Renderer>::width(self),
self.height,
+ self.max_height,
|renderer, limits| self.content.layout(renderer, limits),
)
}
diff --git a/pure/src/widget/container.rs b/pure/src/widget/container.rs
index 8ea9ca72..44ffff8c 100644
--- a/pure/src/widget/container.rs
+++ b/pure/src/widget/container.rs
@@ -156,6 +156,8 @@ where
limits,
self.width,
self.height,
+ self.max_width,
+ self.max_height,
self.padding,
self.horizontal_alignment,
self.vertical_alignment,
diff --git a/pure/src/widget/scrollable.rs b/pure/src/widget/scrollable.rs
index 4e24915b..4118b67e 100644
--- a/pure/src/widget/scrollable.rs
+++ b/pure/src/widget/scrollable.rs
@@ -133,6 +133,7 @@ where
limits,
Widget::<Message, Renderer>::width(self),
self.height,
+ u32::MAX,
|renderer, limits| {
self.content.as_widget().layout(renderer, limits)
},