mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Allow multiple subsequent spaces 📅
This commit is contained in:
parent
467d7203ee
commit
1f009b5b95
@ -139,6 +139,7 @@ impl FlexLayouter {
|
||||
match unit {
|
||||
FlexUnit::Boxed(boxed) => self.layout_box(boxed)?,
|
||||
FlexUnit::Space(space) => {
|
||||
self.layout_space();
|
||||
self.space = Some(space);
|
||||
}
|
||||
|
||||
@ -201,11 +202,7 @@ impl FlexLayouter {
|
||||
self.finish_run()?;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
self.layout_space();
|
||||
|
||||
self.run.content.push((self.run.size.x, boxed));
|
||||
self.run.size.x += size.x;
|
||||
@ -214,6 +211,14 @@ impl FlexLayouter {
|
||||
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) {
|
||||
// TODO
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user