Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: autosize layout limits #745

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/widget/autosize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,21 @@ where
&self,
tree: &mut Tree,
renderer: &Renderer,
_limits: &layout::Limits,
limits: &layout::Limits,
) -> layout::Node {
let mut limits = self.limits;
let min = self.limits.min();
let max = self.limits.max();
if self.auto_width {
limits.min_width(min.width);
limits.max_width(max.width);
let mut my_limits = self.limits;
let min = limits.min();
let max = limits.max();
if !self.auto_width {
my_limits = limits.min_width(min.width).max_width(max.width);
}
if self.auto_height {
limits.min_height(min.height);
limits.max_height(max.height);
if !self.auto_height {
my_limits = limits.min_height(min.height).max_height(max.height);
}
let node = self
.content
.as_widget()
.layout(&mut tree.children[0], renderer, &self.limits);
.layout(&mut tree.children[0], renderer, &my_limits);
let size = node.size();
layout::Node::with_children(size, vec![node])
}
Expand Down
Loading