Skip to content

Commit 3a68095

Browse files
committed
Fix Distributed fill for one element
1 parent 4d972b9 commit 3a68095

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/layout/linear/spacing.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ impl ElementSpacing for DistributeFill {
138138
) -> i32 {
139139
// bit of a mess, but calculate using i32 in case the views don't fit the space
140140
let empty_space = self.0 as i32 - total_size as i32;
141+
142+
if objects <= 1 {
143+
return alignment.align_with_offset(view, reference, empty_space / 2);
144+
}
145+
141146
let base = empty_space / (objects - 1) as i32;
142147
let remainder = empty_space % (objects - 1) as i32;
143148

0 commit comments

Comments
 (0)