diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
| commit | 76fc4cca62f5b955200b2c62cc85b69eea491ece (patch) | |
| tree | 5b8492268c996cf23b13e26c7a4356fbd156286d /src/layout/background.rs | |
| parent | e8057a53856dc09594c9e5861f1cd328531616e0 (diff) | |
Refactor alignments & directions 📐
- Adds lang function
- Refactors execution context
- Adds StackChild and ParChild enums
Diffstat (limited to 'src/layout/background.rs')
| -rw-r--r-- | src/layout/background.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/layout/background.rs b/src/layout/background.rs index 17280a86..d3408182 100644 --- a/src/layout/background.rs +++ b/src/layout/background.rs @@ -8,7 +8,7 @@ pub struct BackgroundNode { /// The background fill. pub fill: Fill, /// The child node to be filled. - pub child: Node, + pub child: AnyNode, } /// The kind of shape to use as a background. @@ -19,10 +19,10 @@ pub enum BackgroundShape { } impl Layout for BackgroundNode { - fn layout(&self, ctx: &mut LayoutContext, areas: &Areas) -> Fragment { - let mut fragment = self.child.layout(ctx, areas); + fn layout(&self, ctx: &mut LayoutContext, areas: &Areas) -> Vec<Frame> { + let mut frames = self.child.layout(ctx, areas); - for frame in fragment.frames_mut() { + for frame in &mut frames { let (point, shape) = match self.shape { BackgroundShape::Rect => (Point::ZERO, Shape::Rect(frame.size)), BackgroundShape::Ellipse => { @@ -34,7 +34,7 @@ impl Layout for BackgroundNode { frame.elements.insert(0, (point, element)); } - fragment + frames } } |
