summaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-10-05 13:39:33 +0200
committerLaurenz <laurmaedje@gmail.com>2020-10-05 13:39:33 +0200
commitd1c07260c0b67098a1b778262c76e6f31c5a5240 (patch)
tree6b78bd83ec83c85fab1e3bf289d52c8de456eca3 /src/layout/mod.rs
parent335fa2d118718b4dba539294a8ef6c96c5bbf09e (diff)
Move align out of BoxLayout 🍫
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 52f7e0e6..7803c747 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -54,16 +54,14 @@ pub async fn layout(
pub struct BoxLayout {
/// The size of the box.
pub size: Size,
- /// How to align this box in a parent container.
- pub align: LayoutAlign,
/// The elements composing this layout.
pub elements: Vec<(Point, LayoutElement)>,
}
impl BoxLayout {
- /// Create an new empty collection.
- pub fn new(size: Size, align: LayoutAlign) -> Self {
- Self { size, align, elements: vec![] }
+ /// Create a new empty collection.
+ pub fn new(size: Size) -> Self {
+ Self { size, elements: vec![] }
}
/// Add an element at a position.
@@ -161,7 +159,7 @@ pub enum Command {
LayoutSyntaxTree(SynTree),
/// Add a finished layout.
- Add(BoxLayout),
+ Add(BoxLayout, LayoutAlign),
/// Add spacing of the given kind along the primary or secondary axis. The
/// kind defines how the spacing interacts with surrounding spacing.
AddSpacing(f64, SpacingKind, GenAxis),