mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Move matrix layout logic's early exit upward (#4583)
This commit is contained in:
parent
0c37a2c233
commit
96d456e267
@ -458,6 +458,12 @@ fn layout_mat_body(
|
||||
gap: Axes<Rel<Abs>>,
|
||||
span: Span,
|
||||
) -> SourceResult<Frame> {
|
||||
let ncols = rows.first().map_or(0, |row| row.len());
|
||||
let nrows = rows.len();
|
||||
if ncols == 0 || nrows == 0 {
|
||||
return Ok(Frame::soft(Size::zero()));
|
||||
}
|
||||
|
||||
let gap = gap.zip_map(ctx.regions.base(), Rel::relative_to);
|
||||
let half_gap = gap * 0.5;
|
||||
|
||||
@ -483,12 +489,6 @@ fn layout_mat_body(
|
||||
_ => (AugmentOffsets::default(), AugmentOffsets::default(), default_stroke),
|
||||
};
|
||||
|
||||
let ncols = rows.first().map_or(0, |row| row.len());
|
||||
let nrows = rows.len();
|
||||
if ncols == 0 || nrows == 0 {
|
||||
return Ok(Frame::soft(Size::zero()));
|
||||
}
|
||||
|
||||
// Before the full matrix body can be laid out, the
|
||||
// individual cells must first be independently laid out
|
||||
// so we can ensure alignment across rows and columns.
|
||||
|
Loading…
x
Reference in New Issue
Block a user