diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
| commit | 264a7dedd42e27cd9e604037640cf0594b2ec46b (patch) | |
| tree | d26feea399d54bb86bd44878f40293983bf5251d /src/layout/stack.rs | |
| parent | ca3df70e2a5069832d7d2135967674c34a155442 (diff) | |
Scheduled maintenance 🔨
- New naming scheme
- TextNode instead of NodeText
- CallExpr instead of ExprCall
- ...
- Less glob imports
- Removes Value::Args variant
- Removes prelude
- Renames Layouted to Fragment
- Moves font into env
- Moves shaping into layout
- Moves frame into separate module
Diffstat (limited to 'src/layout/stack.rs')
| -rw-r--r-- | src/layout/stack.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/layout/stack.rs b/src/layout/stack.rs index 8748c5c7..32eba676 100644 --- a/src/layout/stack.rs +++ b/src/layout/stack.rs @@ -2,7 +2,7 @@ use super::*; /// A node that stacks its children. #[derive(Debug, Clone, PartialEq)] -pub struct NodeStack { +pub struct StackNode { /// The `main` and `cross` directions of this stack. /// /// The children are stacked along the `main` direction. The `cross` @@ -14,26 +14,26 @@ pub struct NodeStack { pub children: Vec<Node>, } -impl Layout for NodeStack { - fn layout(&self, ctx: &mut LayoutContext, areas: &Areas) -> Layouted { +impl Layout for StackNode { + fn layout(&self, ctx: &mut LayoutContext, areas: &Areas) -> Fragment { let mut layouter = StackLayouter::new(self, areas.clone()); for child in &self.children { match child.layout(ctx, &layouter.areas) { - Layouted::Spacing(spacing) => layouter.push_spacing(spacing), - Layouted::Frame(frame, aligns) => layouter.push_frame(frame, aligns), - Layouted::Frames(frames, aligns) => { + Fragment::Spacing(spacing) => layouter.push_spacing(spacing), + Fragment::Frame(frame, aligns) => layouter.push_frame(frame, aligns), + Fragment::Frames(frames, aligns) => { for frame in frames { layouter.push_frame(frame, aligns); } } } } - Layouted::Frames(layouter.finish(), self.aligns) + Fragment::Frames(layouter.finish(), self.aligns) } } -impl From<NodeStack> for NodeAny { - fn from(stack: NodeStack) -> Self { +impl From<StackNode> for AnyNode { + fn from(stack: StackNode) -> Self { Self::new(stack) } } @@ -49,7 +49,7 @@ struct StackLayouter { } impl StackLayouter { - fn new(stack: &NodeStack, areas: Areas) -> Self { + fn new(stack: &StackNode, areas: Areas) -> Self { Self { main: stack.dirs.main.axis(), dirs: stack.dirs, |
