mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Fix flex primary expansion 🚧
This commit is contained in:
parent
863a1a7a00
commit
131e81baaf
@ -183,11 +183,14 @@ impl FlexLayouter {
|
|||||||
fn finish_line(&mut self) -> LayoutResult<Size2D> {
|
fn finish_line(&mut self) -> LayoutResult<Size2D> {
|
||||||
self.finish_partial_line();
|
self.finish_partial_line();
|
||||||
|
|
||||||
|
if self.axes.primary.needs_expansion() {
|
||||||
|
self.line.combined_dimensions.x = self.line.usable;
|
||||||
|
}
|
||||||
|
|
||||||
self.stack.add(Layout {
|
self.stack.add(Layout {
|
||||||
dimensions: self.axes.specialize(Size2D {
|
dimensions: self.axes.specialize(
|
||||||
x: self.line.usable,
|
self.line.combined_dimensions+ Size2D::with_y(self.flex_spacing)
|
||||||
y: self.line.combined_dimensions.y + self.flex_spacing,
|
),
|
||||||
}),
|
|
||||||
actions: self.line.actions.to_vec(),
|
actions: self.line.actions.to_vec(),
|
||||||
debug_render: false,
|
debug_render: false,
|
||||||
})?;
|
})?;
|
||||||
@ -221,8 +224,13 @@ impl FlexLayouter {
|
|||||||
self.line.actions.add_layout(pos, layout);
|
self.line.actions.add_layout(pos, layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.line.combined_dimensions.x = anchor + factor * self.part.dimensions.x;
|
self.line.combined_dimensions.x = match self.axes.primary.alignment {
|
||||||
self.line.combined_dimensions.y.max_eq(self.part.dimensions.x);
|
Alignment::Origin => self.part.dimensions.x,
|
||||||
|
Alignment::Center => self.part.usable / 2 + self.part.dimensions.x / 2,
|
||||||
|
Alignment::End => self.part.usable,
|
||||||
|
};
|
||||||
|
|
||||||
|
self.line.combined_dimensions.y.max_eq(self.part.dimensions.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn layout_box(&mut self, boxed: Layout) -> LayoutResult<()> {
|
fn layout_box(&mut self, boxed: Layout) -> LayoutResult<()> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user