Extend border radius on relevant widgets
This commit is contained in:
parent
8300d86c24
commit
1c86defab5
19 changed files with 111 additions and 99 deletions
22
core/src/border_radius.rs
Normal file
22
core/src/border_radius.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/// The border radii for the corners of a graphics primitive in the order:
|
||||
/// top-left, top-right, bottom-right, bottom-left.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
||||
pub struct BorderRadius([f32; 4]);
|
||||
|
||||
impl From<f32> for BorderRadius {
|
||||
fn from(w: f32) -> Self {
|
||||
Self([w; 4])
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -44,6 +44,7 @@ pub mod window;
|
|||
|
||||
mod angle;
|
||||
mod background;
|
||||
mod border_radius;
|
||||
mod color;
|
||||
mod content_fit;
|
||||
mod element;
|
||||
|
|
@ -60,6 +61,7 @@ mod vector;
|
|||
pub use alignment::Alignment;
|
||||
pub use angle::{Degrees, Radians};
|
||||
pub use background::Background;
|
||||
pub use border_radius::BorderRadius;
|
||||
pub use clipboard::Clipboard;
|
||||
pub use color::Color;
|
||||
pub use content_fit::ContentFit;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ mod null;
|
|||
pub use null::Null;
|
||||
|
||||
use crate::layout;
|
||||
use crate::{Background, Color, Element, Rectangle, Vector};
|
||||
use crate::{Background, BorderRadius, Color, Element, Rectangle, Vector};
|
||||
|
||||
/// A component that can be used by widgets to draw themselves on a screen.
|
||||
pub trait Renderer: Sized {
|
||||
|
|
@ -60,29 +60,6 @@ pub struct Quad {
|
|||
pub border_color: Color,
|
||||
}
|
||||
|
||||
/// The border radii for the corners of a graphics primitive in the order:
|
||||
/// top-left, top-right, bottom-right, bottom-left.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
||||
pub struct BorderRadius([f32; 4]);
|
||||
|
||||
impl From<f32> for BorderRadius {
|
||||
fn from(w: f32) -> Self {
|
||||
Self([w; 4])
|
||||
}
|
||||
}
|
||||
|
||||
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