diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-30 14:12:28 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-30 14:12:28 +0200 |
| commit | f9e115daf54c29358f890b137f50a33a781af680 (patch) | |
| tree | 496de52246629ea8039db6beea94eb779ed2851d /src/library/layout/stack.rs | |
| parent | f7c67cde72e6a67f45180856b332bae9863243bd (diff) | |
New block spacing model
Diffstat (limited to 'src/library/layout/stack.rs')
| -rw-r--r-- | src/library/layout/stack.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/library/layout/stack.rs b/src/library/layout/stack.rs index f915c215..bbfeeab0 100644 --- a/src/library/layout/stack.rs +++ b/src/library/layout/stack.rs @@ -1,5 +1,6 @@ use super::{AlignNode, Spacing}; use crate::library::prelude::*; +use crate::library::text::ParNode; /// Arrange nodes and spacing along an axis. #[derive(Debug, Hash)] @@ -180,7 +181,16 @@ impl<'a> StackLayouter<'a> { .downcast::<AlignNode>() .and_then(|node| node.aligns.get(self.axis)) .map(|align| align.resolve(styles)) - .unwrap_or(self.dir.start().into()); + .unwrap_or_else(|| { + if let Some(Content::Styled(styled)) = node.downcast::<Content>() { + let map = &styled.1; + if map.contains(ParNode::ALIGN) { + return StyleChain::with_root(&styled.1).get(ParNode::ALIGN); + } + } + + self.dir.start().into() + }); let frames = node.layout(ctx, &self.regions, styles)?; let len = frames.len(); |
