idek stuff like stack

This commit is contained in:
2025-08-15 22:59:58 -04:00
parent a7dfacb83e
commit f4aef3a983
15 changed files with 138 additions and 42 deletions

View File

@@ -1,4 +1,4 @@
use crate::{Dir, Painter, Sign, UINum, UiRegion, UIScalar, Widget, WidgetId};
use crate::{Dir, Painter, Sign, UiNum, UiRegion, UIScalar, Widget, WidgetId};
pub struct Span {
pub children: Vec<(WidgetId, SpanLen)>,
@@ -80,19 +80,19 @@ pub enum SpanLen {
Relative(f32),
}
pub fn fixed<N: UINum>(x: N) -> SpanLen {
pub fn fixed<N: UiNum>(x: N) -> SpanLen {
SpanLen::Fixed(x.to_f32())
}
pub fn ratio<N: UINum>(x: N) -> SpanLen {
pub fn ratio<N: UiNum>(x: N) -> SpanLen {
SpanLen::Ratio(x.to_f32())
}
pub fn rel<N: UINum>(x: N) -> SpanLen {
pub fn rel<N: UiNum>(x: N) -> SpanLen {
SpanLen::Relative(x.to_f32())
}
impl<N: UINum> From<N> for SpanLen {
impl<N: UiNum> From<N> for SpanLen {
fn from(value: N) -> Self {
Self::Ratio(value.to_f32())
}