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 {
|
self.primitives.push(Primitive::Quad {
|
||||||
bounds: quad.bounds,
|
bounds: quad.bounds,
|
||||||
background: background.into(),
|
background: background.into(),
|
||||||
border_radius: quad.border_radius.to_array(),
|
border_radius: quad.border_radius.into(),
|
||||||
border_width: quad.border_width,
|
border_width: quad.border_width,
|
||||||
border_color: quad.border_color,
|
border_color: quad.border_color,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ pub struct Quad {
|
||||||
pub bounds: Rectangle,
|
pub bounds: Rectangle,
|
||||||
|
|
||||||
/// The border radius of the [`Quad`].
|
/// The border radius of the [`Quad`].
|
||||||
pub border_radius: QuadBorderRadius,
|
pub border_radius: BorderRadius,
|
||||||
|
|
||||||
/// The border width of the [`Quad`].
|
/// The border width of the [`Quad`].
|
||||||
pub border_width: f32,
|
pub border_width: f32,
|
||||||
|
|
@ -59,30 +59,29 @@ pub struct Quad {
|
||||||
pub border_color: Color,
|
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.
|
/// top-left, top-right, bottom-right, bottom-left.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
||||||
pub struct QuadBorderRadius([f32; 4]);
|
pub struct BorderRadius([f32; 4]);
|
||||||
|
|
||||||
impl QuadBorderRadius {
|
impl From<f32> for BorderRadius {
|
||||||
/// 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 {
|
|
||||||
fn from(w: f32) -> Self {
|
fn from(w: f32) -> Self {
|
||||||
Self([w; 4])
|
Self([w; 4])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<[f32; 4]> for QuadBorderRadius {
|
impl From<[f32; 4]> for BorderRadius {
|
||||||
fn from(radi: [f32; 4]) -> Self {
|
fn from(radi: [f32; 4]) -> Self {
|
||||||
Self(radi)
|
Self(radi)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<BorderRadius> for [f32; 4] {
|
||||||
|
fn from(radi: BorderRadius) -> Self {
|
||||||
|
radi.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The styling attributes of a [`Renderer`].
|
/// The styling attributes of a [`Renderer`].
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct Style {
|
pub struct Style {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue