Use f32 for border_width and border_radius

This commit is contained in:
Héctor Ramón Jiménez 2020-11-23 00:31:50 +01:00
parent ea1a7248d2
commit f41eacc3dc
32 changed files with 134 additions and 134 deletions

View file

@ -156,8 +156,8 @@ impl<'a> Layer<'a> {
color: match background {
Background::Color(color) => color.into_linear(),
},
border_radius: *border_radius as f32,
border_width: *border_width as f32,
border_radius: *border_radius,
border_width: *border_width,
border_color: border_color.into_linear(),
});
}

View file

@ -29,7 +29,7 @@ where
background: style.background,
border_color: style.border_color,
border_width: style.border_width,
border_radius: 0,
border_radius: 0.0,
},
primitives,
],
@ -80,8 +80,8 @@ where
bounds,
background: style.selected_background,
border_color: Color::TRANSPARENT,
border_width: 0,
border_radius: 0,
border_width: 0.0,
border_radius: 0.0,
});
}

View file

@ -40,9 +40,9 @@ pub enum Primitive {
/// The background of the quad
background: Background,
/// The border radius of the quad
border_radius: u16,
border_radius: f32,
/// The border width of the quad
border_width: u16,
border_width: f32,
/// The border color of the quad
border_color: Color,
},

View file

@ -119,8 +119,8 @@ fn explain_layout(
primitives.push(Primitive::Quad {
bounds: layout.bounds(),
background: Background::Color(Color::TRANSPARENT),
border_radius: 0,
border_width: 1,
border_radius: 0.0,
border_width: 1.0,
border_color: [0.6, 0.6, 0.6, 0.5].into(),
});

View file

@ -66,7 +66,7 @@ where
);
(
if styling.background.is_some() || styling.border_width > 0 {
if styling.background.is_some() || styling.border_width > 0.0 {
let background = Primitive::Quad {
bounds,
background: styling
@ -93,7 +93,7 @@ where
[0.0, 0.0, 0.0, 0.5].into(),
),
border_radius: styling.border_radius,
border_width: 0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
};

View file

@ -62,7 +62,7 @@ pub(crate) fn background(
bounds: Rectangle,
style: &container::Style,
) -> Option<Primitive> {
if style.background.is_some() || style.border_width > 0 {
if style.background.is_some() || style.border_width > 0.0 {
Some(Primitive::Quad {
bounds,
background: style

View file

@ -43,7 +43,7 @@ where
bounds: Rectangle { ..bounds },
background: style.background,
border_radius: style.border_radius,
border_width: 0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
}],
};
@ -57,7 +57,7 @@ where
},
background: style.bar,
border_radius: style.border_radius,
border_width: 0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
};

View file

@ -42,7 +42,7 @@ where
let radio = Primitive::Quad {
bounds,
background: style.background,
border_radius: (size / 2.0) as u16,
border_radius: size / 2.0,
border_width: style.border_width,
border_color: style.border_color,
};
@ -58,8 +58,8 @@ where
height: bounds.height - dot_size,
},
background: Background::Color(style.dot_color),
border_radius: (dot_size / 2.0) as u16,
border_width: 0,
border_radius: dot_size / 2.0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
};

View file

@ -43,7 +43,7 @@ where
},
background: Background::Color(style.color),
border_radius: style.radius,
border_width: 0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
}
} else {
@ -63,7 +63,7 @@ where
},
background: Background::Color(style.color),
border_radius: style.radius,
border_width: 0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
}
};

View file

@ -103,7 +103,7 @@ where
};
let is_scrollbar_visible =
style.background.is_some() || style.border_width > 0;
style.background.is_some() || style.border_width > 0.0;
let scroller = if is_mouse_over
|| state.is_scroller_grabbed()

View file

@ -57,8 +57,8 @@ where
height: 2.0,
},
background: Background::Color(style.rail_colors.0),
border_radius: 0,
border_width: 0,
border_radius: 0.0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
Primitive::Quad {
@ -69,8 +69,8 @@ where
height: 2.0,
},
background: Background::Color(style.rail_colors.1),
border_radius: 0,
border_width: 0,
border_radius: 0.0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
);
@ -82,7 +82,7 @@ where
.shape
{
HandleShape::Circle { radius } => {
(f32::from(radius * 2), f32::from(radius * 2), radius)
(radius * 2.0, radius * 2.0, radius)
}
HandleShape::Rectangle {
width,

View file

@ -149,8 +149,8 @@ where
background: Background::Color(
style_sheet.value_color(),
),
border_radius: 0,
border_width: 0,
border_radius: 0.0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
offset,
@ -193,8 +193,8 @@ where
background: Background::Color(
style_sheet.selection_color(),
),
border_radius: 0,
border_width: 0,
border_radius: 0.0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
if end == right {