diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-19 15:31:29 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-19 15:52:15 +0200 |
| commit | a6f260ca39f70f82617eca87855789413715f47d (patch) | |
| tree | 08141ae619bd21e0544d21433bce759aebc7ba83 /src/layout/image.rs | |
| parent | fdab7158c91c52a4ace211c804fdd8e9110f56de (diff) | |
Refactor layouting a bit
Notably:
- Handle aspect ratio in fixed node
- Inline constraint inflation into pad node
Diffstat (limited to 'src/layout/image.rs')
| -rw-r--r-- | src/layout/image.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/layout/image.rs b/src/layout/image.rs index 2c20642b..02a907f5 100644 --- a/src/layout/image.rs +++ b/src/layout/image.rs @@ -19,11 +19,10 @@ impl Layout for ImageNode { fn layout( &self, ctx: &mut LayoutContext, - regions: &Regions, + &Regions { current, base, expand, .. }: &Regions, ) -> Vec<Constrained<Rc<Frame>>> { - let Regions { current, base, .. } = regions; - let mut constraints = Constraints::new(regions.expand); - constraints.set_base_using_linears(Spec::new(self.width, self.height), regions); + let mut constraints = Constraints::new(expand); + constraints.set_base_if_linear(base, Spec::new(self.width, self.height)); let width = self.width.map(|w| w.resolve(base.width)); let height = self.height.map(|w| w.resolve(base.height)); |
