mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Allow multiple subsequent spaces 📅
This commit is contained in:
parent
467d7203ee
commit
1f009b5b95
@ -139,6 +139,7 @@ impl FlexLayouter {
|
|||||||
match unit {
|
match unit {
|
||||||
FlexUnit::Boxed(boxed) => self.layout_box(boxed)?,
|
FlexUnit::Boxed(boxed) => self.layout_box(boxed)?,
|
||||||
FlexUnit::Space(space) => {
|
FlexUnit::Space(space) => {
|
||||||
|
self.layout_space();
|
||||||
self.space = Some(space);
|
self.space = Some(space);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,11 +202,7 @@ impl FlexLayouter {
|
|||||||
self.finish_run()?;
|
self.finish_run()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(space) = self.space.take() {
|
self.layout_space();
|
||||||
if self.run.size.x > Size::zero() && self.run.size.x + space <= self.usable {
|
|
||||||
self.run.size.x += space;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.run.content.push((self.run.size.x, boxed));
|
self.run.content.push((self.run.size.x, boxed));
|
||||||
self.run.size.x += size.x;
|
self.run.size.x += size.x;
|
||||||
@ -214,6 +211,14 @@ impl FlexLayouter {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn layout_space(&mut self) {
|
||||||
|
if let Some(space) = self.space.take() {
|
||||||
|
if self.run.size.x > Size::zero() && self.run.size.x + space <= self.usable {
|
||||||
|
self.run.size.x += space;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn layout_set_axes(&mut self, axes: LayoutAxes) {
|
fn layout_set_axes(&mut self, axes: LayoutAxes) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user