diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-09 14:17:24 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-09 14:42:14 +0100 |
| commit | c38d72383d2068361d635d6c1c78ba97aa917801 (patch) | |
| tree | e758418a2d704d69dee88faf4a9a9c69b25b47ca /library/src/math/mod.rs | |
| parent | d7a65fa26d131179d9d82226e5ee1b562084e48a (diff) | |
Make all optional fields settable
Diffstat (limited to 'library/src/math/mod.rs')
| -rw-r--r-- | library/src/math/mod.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs index 3f0b0607..0c9dc338 100644 --- a/library/src/math/mod.rs +++ b/library/src/math/mod.rs @@ -134,21 +134,20 @@ pub fn module() -> Module { /// Category: math #[node(Show, Finalize, Layout, LayoutMath)] pub struct FormulaNode { + /// Whether the formula is displayed as a separate block. + #[default(false)] + pub block: bool, + /// The content of the formula. #[positional] #[required] pub body: Content, - - /// Whether the formula is displayed as a separate block. - #[named] - #[default(false)] - pub block: bool, } impl Show for FormulaNode { - fn show(&self, _: &mut Vt, _: &Content, _: StyleChain) -> SourceResult<Content> { + fn show(&self, _: &mut Vt, _: &Content, styles: StyleChain) -> SourceResult<Content> { let mut realized = self.clone().pack().guarded(Guard::Base(NodeId::of::<Self>())); - if self.block() { + if self.block(styles) { realized = realized.aligned(Axes::with_x(Some(Align::Center.into()))) } Ok(realized) @@ -156,7 +155,7 @@ impl Show for FormulaNode { } impl Finalize for FormulaNode { - fn finalize(&self, realized: Content) -> Content { + fn finalize(&self, realized: Content, _: StyleChain) -> Content { realized .styled(TextNode::set_weight(FontWeight::from_number(450))) .styled(TextNode::set_font(FontList(vec