diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-11-16 11:10:53 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-11-16 11:10:53 +0100 |
| commit | ac4d501945e9b63f6b5f11c4c1a2ec0738d0b058 (patch) | |
| tree | f5edb15b151ea22a3ad436950e2f637449f2fe21 /src/layout/flex.rs | |
| parent | 261ef9e33a8548d4b7aa53e69e71866648982ae8 (diff) | |
Move generalization/specialization methods 🚚
Diffstat (limited to 'src/layout/flex.rs')
| -rw-r--r-- | src/layout/flex.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/layout/flex.rs b/src/layout/flex.rs index c136ad0d..a65391da 100644 --- a/src/layout/flex.rs +++ b/src/layout/flex.rs @@ -129,7 +129,7 @@ impl FlexLayouter { /// Layout a content box into the current flex run or start a new run if /// it does not fit. fn layout_box(&mut self, boxed: Layout) -> LayoutResult<()> { - let size = boxed.dimensions.generalized(self.ctx.axes); + let size = self.ctx.axes.generalize(boxed.dimensions); let space = self.space.unwrap_or(Size::zero()); let new_run_size = self.run.size.x + space + size.x; @@ -166,14 +166,14 @@ impl FlexLayouter { fn finish_run(&mut self) -> LayoutResult<()> { let mut actions = LayoutActionList::new(); for (x, layout) in self.run.content.drain(..) { - let position = Size2D::with_x(x).specialized(self.ctx.axes); + let position = self.ctx.axes.specialize(Size2D::with_x(x)); actions.add_layout(position, layout); } self.run.size.y += self.ctx.flex_spacing; self.stack.add(Layout { - dimensions: self.run.size.specialized(self.ctx.axes), + dimensions: self.ctx.axes.specialize(self.run.size), actions: actions.into_vec(), debug_render: false, })?; @@ -183,6 +183,11 @@ impl FlexLayouter { Ok(()) } + /// Update the axes in use by this flex layouter. + pub fn set_axes(&self, axes: LayoutAxes) { + + } + /// This layouter's context. pub fn ctx(&self) -> FlexContext { self.ctx |
