summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/math/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-09-13 12:28:30 +0200
committerLaurenz <laurmaedje@gmail.com>2023-09-13 13:44:28 +0200
commit8fb225feb4a10a916c239faaa130cf5aae164284 (patch)
treee6caa005cd9a63bf69c1999c41a665b9adcdb234 /crates/typst-library/src/math/mod.rs
parent8927f3d572100377f2feb466b81a8700f0ee3a28 (diff)
Fix box in 100% width block
Fixes #2128
Diffstat (limited to 'crates/typst-library/src/math/mod.rs')
-rw-r--r--crates/typst-library/src/math/mod.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/crates/typst-library/src/math/mod.rs b/crates/typst-library/src/math/mod.rs
index 578064ba..3ae3f23a 100644
--- a/crates/typst-library/src/math/mod.rs
+++ b/crates/typst-library/src/math/mod.rs
@@ -457,18 +457,20 @@ impl LayoutMath for Content {
return Ok(());
}
+ if let Some(boxed) = self.to::<BoxElem>() {
+ let frame = ctx.layout_box(boxed)?;
+ ctx.push(FrameFragment::new(ctx, frame).with_spaced(true));
+ return Ok(());
+ }
+
if let Some(elem) = self.with::<dyn LayoutMath>() {
return elem.layout_math(ctx);
}
let mut frame = ctx.layout_content(self)?;
if !frame.has_baseline() {
- if self.is::<BoxElem>() {
- frame.set_baseline(frame.height());
- } else {
- let axis = scaled!(ctx, axis_height);
- frame.set_baseline(frame.height() / 2.0 + axis);
- }
+ let axis = scaled!(ctx, axis_height);
+ frame.set_baseline(frame.height() / 2.0 + axis);
}
ctx.push(FrameFragment::new(ctx, frame).with_spaced(true));