Skip to content

Commit

Permalink
Fix max_width and max_height for Container
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj authored and nicksenger committed Aug 31, 2022
1 parent 9662501 commit 01a2aef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion native/src/widget/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -171,6 +179,8 @@ where
limits,
self.width,
self.height,
self.max_width,
self.max_height,
self.padding,
self.horizontal_alignment,
self.vertical_alignment,
Expand Down
2 changes: 2 additions & 0 deletions pure/src/widget/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ where
limits,
self.width,
self.height,
self.max_width,
self.max_height,
self.padding,
self.horizontal_alignment,
self.vertical_alignment,
Expand Down

0 comments on commit 01a2aef

Please sign in to comment.