use waterui_core::metadata::MetadataKey;
use waterui_graphics::color::Color;
use waterui_layout::EdgeSet;
#[derive(Debug)]
pub struct Border {
pub color: Color,
pub width: f32,
pub corner_radius: f32,
pub edges: EdgeSet,
}
impl MetadataKey for Border {}
impl Border {
#[must_use]
pub fn new(color: impl Into<Color>, width: f32) -> Self {
Self {
color: color.into(),
width,
corner_radius: 0.0,
edges: EdgeSet::ALL,
}
}
#[must_use]
pub const fn corner_radius(mut self, radius: f32) -> Self {
self.corner_radius = radius;
self
}
#[must_use]
pub const fn edges(mut self, edges: EdgeSet) -> Self {
self.edges = edges;
self
}
}
impl Default for Border {
fn default() -> Self {
Self {
color: Color::srgb(0, 0, 0),
width: 1.0,
corner_radius: 0.0,
edges: EdgeSet::ALL,
}
}
}