Rename QuadBorderRadius to BorderRadius
This commit is contained in:
parent
15f21641b7
commit
676d8efe03
2 changed files with 13 additions and 14 deletions
|
|
@ -109,7 +109,7 @@ where
|
|||
self.primitives.push(Primitive::Quad {
|
||||
bounds: quad.bounds,
|
||||
background: background.into(),
|
||||
border_radius: quad.border_radius.to_array(),
|
||||
border_radius: quad.border_radius.into(),
|
||||
border_width: quad.border_width,
|
||||
border_color: quad.border_color,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ pub struct Quad {
|
|||
pub bounds: Rectangle,
|
||||
|
||||
/// The border radius of the [`Quad`].
|
||||
pub border_radius: QuadBorderRadius,
|
||||
pub border_radius: BorderRadius,
|
||||
|
||||
/// The border width of the [`Quad`].
|
||||
pub border_width: f32,
|
||||
|
|
@ -59,30 +59,29 @@ pub struct Quad {
|
|||
pub border_color: Color,
|
||||
}
|
||||
|
||||
/// The border radi for the corners of a [`Quad`] in the order:
|
||||
/// The border radi for the corners of a graphics primitive in the order:
|
||||
/// top-left, top-right, bottom-right, bottom-left.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct QuadBorderRadius([f32; 4]);
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
||||
pub struct BorderRadius([f32; 4]);
|
||||
|
||||
impl QuadBorderRadius {
|
||||
/// Convert the corners of the Quad into an array [top_left, top_right, bottom_left, bottom_right].
|
||||
pub fn to_array(self) -> [f32; 4] {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<f32> for QuadBorderRadius {
|
||||
impl From<f32> for BorderRadius {
|
||||
fn from(w: f32) -> Self {
|
||||
Self([w; 4])
|
||||
}
|
||||
}
|
||||
|
||||
impl From<[f32; 4]> for QuadBorderRadius {
|
||||
impl From<[f32; 4]> for BorderRadius {
|
||||
fn from(radi: [f32; 4]) -> Self {
|
||||
Self(radi)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BorderRadius> for [f32; 4] {
|
||||
fn from(radi: BorderRadius) -> Self {
|
||||
radi.0
|
||||
}
|
||||
}
|
||||
|
||||
/// The styling attributes of a [`Renderer`].
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct Style {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue