mirror of
https://github.com/griffi-gh/hUI.git
synced 2024-11-25 00:18:41 -06:00
aaa
This commit is contained in:
parent
bbc1d9f1ff
commit
7bfd12749b
|
@ -1,4 +1,4 @@
|
||||||
use crate::rect::FillColor;
|
use crate::rect::{Corners, FillColor};
|
||||||
|
|
||||||
pub mod point;
|
pub mod point;
|
||||||
pub mod layer;
|
pub mod layer;
|
||||||
|
@ -20,10 +20,10 @@ pub struct Frame {
|
||||||
layers: Vec<FrameLayer>
|
layers: Vec<FrameLayer>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Into<FillColor>> From<T> for Frame {
|
impl<T: Into<RectLayer>> From<T> for Frame {
|
||||||
fn from(color: T) -> Self {
|
fn from(layer: T) -> Self {
|
||||||
let mut frame = Self::default();
|
let mut frame = Self::default();
|
||||||
frame.add(RectLayer::from_color(color));
|
frame.add(layer.into());
|
||||||
frame
|
frame
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,17 @@ pub enum FrameLayer {
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct RectLayer {
|
pub struct RectLayer {
|
||||||
color: FillColor,
|
pub color: FillColor,
|
||||||
image: Option<ImageHandle>,
|
pub image: Option<ImageHandle>,
|
||||||
top_left: FramePoint2d,
|
pub top_left: FramePoint2d,
|
||||||
bottom_right: FramePoint2d,
|
pub bottom_right: FramePoint2d,
|
||||||
corner_radius: Corners<f32>,
|
pub corner_radius: Corners<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Into<FillColor>> From<T> for RectLayer {
|
||||||
|
fn from(color: T) -> Self {
|
||||||
|
Self::from_color(color)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RectLayer {
|
impl RectLayer {
|
||||||
|
@ -65,9 +71,9 @@ impl Default for RectLayer {
|
||||||
Self {
|
Self {
|
||||||
color: FillColor::default(),
|
color: FillColor::default(),
|
||||||
image: None,
|
image: None,
|
||||||
top_left: FramePoint2d::default(),
|
top_left: FramePoint2d::TOP_LEFT,
|
||||||
bottom_right: FramePoint2d::default(),
|
bottom_right: FramePoint2d::BOTTOM_RIGHT,
|
||||||
corner_radius: Corners::default(),
|
corner_radius: Corners::all(0.),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue