use super::*;
impl Default for Transform2D {
fn default() -> Self {
Self::new(0.0, 0.0, 1.0, 1.0, 0.0)
}
}
impl Default for PaintStyle {
fn default() -> Self {
Self {
background: None,
gradient: None,
border: Border::default(),
radius: CornerRadius::default(),
shadow: None,
focus_ring: None,
opacity: 1.0,
transform: Transform2D::default(),
cursor: CursorIcon::Default,
pointer_events: PointerEvents::Auto,
stop_scroll_propagation: false,
stop_event_propagation: false,
}
}
}
impl Transform2D {
#[must_use]
pub fn is_identity(&self) -> bool {
self.get_translate_x() == 0.0
&& self.get_translate_y() == 0.0
&& self.get_scale_x() == 1.0
&& self.get_scale_y() == 1.0
&& self.get_rotation_rad() == 0.0
}
}
impl PaintStyle {
#[must_use]
pub fn background_color(&self) -> Option<Color> {
let Self { background, .. } = *self;
background
}
#[must_use]
pub fn background_gradient(&self) -> Option<LinearGradient> {
let Self { gradient, .. } = *self;
gradient
}
#[must_use]
pub fn box_shadow(&self) -> Option<Shadow> {
let Self { shadow, .. } = *self;
shadow
}
#[must_use]
pub fn focus_ring_border(&self) -> Option<Border> {
let Self { focus_ring, .. } = *self;
focus_ring
}
}