summaryrefslogtreecommitdiff
path: root/src/layout/stacked.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-11-17 20:57:50 +0100
committerLaurenz <laurmaedje@gmail.com>2019-11-17 20:57:50 +0100
commit14259c7d09c12327b18aba21cc577e68ad283eda (patch)
tree0f9a7a138141e84cfcb8691f41e29f7493879eab /src/layout/stacked.rs
parentf6cb4d725ee6e4fd09b92b5af7348d11ac951b10 (diff)
Fix alignment bugs ✔
Diffstat (limited to 'src/layout/stacked.rs')
-rw-r--r--src/layout/stacked.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/layout/stacked.rs b/src/layout/stacked.rs
index 8113a4b7..b77c0582 100644
--- a/src/layout/stacked.rs
+++ b/src/layout/stacked.rs
@@ -58,7 +58,7 @@ impl StackLayouter {
// Search for a suitable space to insert the box.
while !self.usable.fits(new_dimensions) {
- if self.in_last_space() {
+ if self.boxes.is_empty() && self.in_last_space() {
Err(LayoutError::NotEnoughSpace("cannot fit box into stack"))?;
}
@@ -70,7 +70,7 @@ impl StackLayouter {
let anchor = self.ctx.axes.anchor(size);
self.boxes.push((offset, anchor, layout));
- self.dimensions.y += size.y;
+ self.dimensions = new_dimensions;
Ok(())
}
@@ -216,8 +216,8 @@ fn merge_sizes(a: Size2D, b: Size2D) -> Size2D {
}
fn needs_expansion(axis: AlignedAxis) -> bool {
- match (axis.axis.is_positive(), axis.alignment) {
- (true, Alignment::Origin) | (false, Alignment::End) => false,
- _ => true,
- }
+ !matches!(
+ (axis.axis.is_positive(), axis.alignment),
+ (true, Alignment::Origin) | (false, Alignment::End)
+ )
}