summaryrefslogtreecommitdiff
path: root/src/layout/flex.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-11-17 11:11:53 +0100
committerLaurenz <laurmaedje@gmail.com>2019-11-17 11:11:53 +0100
commitbd66ebd68344f0d02f5dc6163f7d2aa0b4ded79d (patch)
tree72fa8e5df0835b8a2312a0040cecb6cbb1ae0dd1 /src/layout/flex.rs
parent796c2486cee82f6e5aefc2d7d02f82a7eeb35a07 (diff)
Prepare axis setting for flex layouter ♟
Diffstat (limited to 'src/layout/flex.rs')
-rw-r--r--src/layout/flex.rs17
1 files changed, 12 insertions, 5 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