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

@@ -72,7 +72,7 @@ impl CustomLayout {
}
#[must_use]
pub fn primary_width_percentage(&self) -> Option<usize> {
pub fn primary_width_percentage(&self) -> Option<f32> {
for column in self.iter() {
if let Column::Primary(Option::Some(ColumnWidth::WidthPercentage(percentage))) = column
{
@@ -83,7 +83,7 @@ impl CustomLayout {
None
}
pub fn set_primary_width_percentage(&mut self, percentage: usize) {
pub fn set_primary_width_percentage(&mut self, percentage: f32) {
for column in self.iter_mut() {
if let Column::Primary(Option::Some(ColumnWidth::WidthPercentage(current))) = column {
*current = percentage;
@@ -262,7 +262,7 @@ pub enum Column {
#[derive(Clone, Copy, Debug, Serialize, Deserialize, JsonSchema)]
pub enum ColumnWidth {
WidthPercentage(usize),
WidthPercentage(f32),
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize, JsonSchema)]