summaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/flex.rs17
-rw-r--r--src/layout/tree.rs4
2 files changed, 15 insertions, 6 deletions
diff --git a/src/layout/flex.rs b/src/layout/flex.rs
index 20686e9f..01086c32 100644
--- a/src/layout/flex.rs
+++ b/src/layout/flex.rs
@@ -48,6 +48,7 @@ enum FlexUnit {
Space(Size),
/// A forced break of the current flex run.
Break,
+ SetAxes(LayoutAxes),
}
#[derive(Debug, Clone)]
@@ -97,6 +98,11 @@ impl FlexLayouter {
self.units.push(FlexUnit::Break);
}
+ /// Update the axes in use by this flex layouter.
+ pub fn set_axes(&self, axes: LayoutAxes) {
+ self.units.push(FlexUnit::SetAxes(axes));
+ }
+
/// Compute the justified layout.
///
/// The layouter is not consumed by this to prevent ownership problems
@@ -117,6 +123,8 @@ impl FlexLayouter {
self.space = None;
self.finish_run()?;
},
+
+ FlexUnit::SetAxes(axes) => self.layout_set_axes(axes),
}
}
@@ -162,6 +170,10 @@ impl FlexLayouter {
Ok(())
}
+ fn layout_set_axes(&mut self, axes: LayoutAxes) {
+ // TODO
+ }
+
/// Finish the current flex run.
fn finish_run(&mut self) -> LayoutResult<()> {
let mut actions = LayoutActionList::new();
@@ -183,11 +195,6 @@ 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
diff --git a/src/layout/tree.rs b/src/layout/tree.rs
index 9cbcd641..89e47c91 100644
--- a/src/layout/tree.rs
+++ b/src/layout/tree.rs
@@ -100,8 +100,10 @@ impl<'a, 'p> TreeLayouter<'a, 'p> {
Command::SetStyle(style) => *self.style.to_mut() = style,
Command::SetAxes(axes) => {
- self.stack.set_axes(axes);
self.flex.set_axes(axes);
+ if axes.secondary != self.ctx.axes.secondary {
+ self.stack.set_axes(axes);
+ }
self.ctx.axes = axes;
}
}