summaryrefslogtreecommitdiff
path: root/src/layout/tree.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-11-22 20:15:00 +0100
committerLaurenz <laurmaedje@gmail.com>2019-11-22 20:15:00 +0100
commit6ff60bc3688d8ae2caa3ea18bc23963d25ab5daa (patch)
tree51f4abdee9bfdda98f8d865d45a30c94556d004b /src/layout/tree.rs
parent4ab7ec6a9a1159bdf1e22eccb56d6d827aaf5b23 (diff)
Fix secondary non-origin alignment 🚧
Diffstat (limited to 'src/layout/tree.rs')
-rw-r--r--src/layout/tree.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/layout/tree.rs b/src/layout/tree.rs
index f6a8f408..f5ae2435 100644
--- a/src/layout/tree.rs
+++ b/src/layout/tree.rs
@@ -58,16 +58,19 @@ impl<'a, 'p> TreeLayouter<'a, 'p> {
}
fn layout_space(&mut self) {
- self.flex.add_primary_space(word_spacing(&self.style), true);
+ self.flex.add_primary_space(word_spacing(&self.style), SpaceKind::Soft);
}
fn layout_paragraph(&mut self) -> LayoutResult<()> {
- self.flex.add_secondary_space(paragraph_spacing(&self.style), true)
+ self.flex.add_secondary_space(paragraph_spacing(&self.style), SpaceKind::Soft)
}
fn layout_func(&mut self, func: &FuncCall) -> LayoutResult<()> {
let (first, second) = self.flex.remaining()?;
+ let mut axes = self.ctx.axes.expanding(false);
+ axes.secondary.alignment = Alignment::Origin;
+
let ctx = |spaces| {
LayoutContext {
loader: self.ctx.loader,
@@ -75,7 +78,7 @@ impl<'a, 'p> TreeLayouter<'a, 'p> {
text_style: &self.style,
page_style: self.ctx.page_style,
spaces,
- axes: self.ctx.axes.expanding(false),
+ axes,
expand: false,
}
};
@@ -106,8 +109,10 @@ impl<'a, 'p> TreeLayouter<'a, 'p> {
Command::Add(layout) => self.flex.add(layout),
Command::AddMultiple(layouts) => self.flex.add_multiple(layouts),
- Command::AddPrimarySpace(space) => self.flex.add_primary_space(space, false),
- Command::AddSecondarySpace(space) => self.flex.add_secondary_space(space, false)?,
+ Command::AddPrimarySpace(space)
+ => self.flex.add_primary_space(space, SpaceKind::Hard),
+ Command::AddSecondarySpace(space)
+ => self.flex.add_secondary_space(space, SpaceKind::Hard)?,
Command::FinishLine => self.flex.add_break(),
Command::FinishRun => { self.flex.finish_run()?; },