feat(wm): allow f32 width % for custom layouts

This commit allows users to provide an f32 value for the WidthPercentage
on the primary column of a custom layout.
This commit is contained in:
LGUG2Z
2023-06-22 08:49:38 -07:00
parent c4be0636f7
commit 087b08612d
2 changed files with 8 additions and 8 deletions

View File

@@ -683,15 +683,15 @@ impl WindowManager {
if matches!(axis, Axis::Horizontal) {
let percentage = custom
.primary_width_percentage()
.unwrap_or(100 / custom.len());
.unwrap_or(100.0 / (custom.len() as f32));
if no_layout_rules {
match sizing {
Sizing::Increase => {
custom.set_primary_width_percentage(percentage + 5);
custom.set_primary_width_percentage(percentage + 5.0);
}
Sizing::Decrease => {
custom.set_primary_width_percentage(percentage - 5);
custom.set_primary_width_percentage(percentage - 5.0);
}
}
} else {
@@ -700,10 +700,10 @@ impl WindowManager {
if let Layout::Custom(ref mut custom) = rule.1 {
match sizing {
Sizing::Increase => {
custom.set_primary_width_percentage(percentage + 5);
custom.set_primary_width_percentage(percentage + 5.0);
}
Sizing::Decrease => {
custom.set_primary_width_percentage(percentage - 5);
custom.set_primary_width_percentage(percentage - 5.0);
}
}
}