From 897a574931e59a0c59a31a3f78781cde7180a83b Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Sat, 23 Mar 2024 15:09:05 +0100 Subject: [PATCH] aaa --- hui/src/frame.rs | 8 ++++---- hui/src/frame/layer.rs | 22 ++++++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/hui/src/frame.rs b/hui/src/frame.rs index e3ea565..651deb2 100644 --- a/hui/src/frame.rs +++ b/hui/src/frame.rs @@ -1,4 +1,4 @@ -use crate::rect::FillColor; +use crate::rect::{Corners, FillColor}; pub mod point; pub mod layer; @@ -20,10 +20,10 @@ pub struct Frame { layers: Vec } -impl> From for Frame { - fn from(color: T) -> Self { +impl> From for Frame { + fn from(layer: T) -> Self { let mut frame = Self::default(); - frame.add(RectLayer::from_color(color)); + frame.add(layer.into()); frame } } diff --git a/hui/src/frame/layer.rs b/hui/src/frame/layer.rs index ce76648..e2d568e 100644 --- a/hui/src/frame/layer.rs +++ b/hui/src/frame/layer.rs @@ -20,11 +20,17 @@ pub enum FrameLayer { #[derive(Clone, Copy)] pub struct RectLayer { - color: FillColor, - image: Option, - top_left: FramePoint2d, - bottom_right: FramePoint2d, - corner_radius: Corners, + pub color: FillColor, + pub image: Option, + pub top_left: FramePoint2d, + pub bottom_right: FramePoint2d, + pub corner_radius: Corners, +} + +impl> From for RectLayer { + fn from(color: T) -> Self { + Self::from_color(color) + } } impl RectLayer { @@ -65,9 +71,9 @@ impl Default for RectLayer { Self { color: FillColor::default(), image: None, - top_left: FramePoint2d::default(), - bottom_right: FramePoint2d::default(), - corner_radius: Corners::default(), + top_left: FramePoint2d::TOP_LEFT, + bottom_right: FramePoint2d::BOTTOM_RIGHT, + corner_radius: Corners::all(0.), } } }