initial text wrapping impl (resizing will break)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
use std::marker::Destruct;
|
||||
|
||||
use crate::{
|
||||
layout::{Align, Axis, Vec2},
|
||||
layout::{Align, Axis, UiNum, Vec2},
|
||||
util::{LerpUtil, impl_op},
|
||||
};
|
||||
|
||||
@@ -25,16 +27,16 @@ impl UiVec2 {
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn abs(abs: Vec2) -> Self {
|
||||
pub const fn abs(abs: impl const Into<Vec2>) -> Self {
|
||||
Self {
|
||||
rel: Vec2::ZERO,
|
||||
abs,
|
||||
abs: abs.into(),
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn rel(rel: Vec2) -> Self {
|
||||
pub const fn rel(rel: impl const Into<Vec2>) -> Self {
|
||||
Self {
|
||||
rel,
|
||||
rel: rel.into(),
|
||||
abs: Vec2::ZERO,
|
||||
}
|
||||
}
|
||||
@@ -133,6 +135,15 @@ impl const From<Vec2> for UiVec2 {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: const UiNum, U: const UiNum> const From<(T, U)> for UiVec2
|
||||
where
|
||||
(T, U): const Destruct,
|
||||
{
|
||||
fn from(abs: (T, U)) -> Self {
|
||||
Self::abs(abs)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct UiScalar {
|
||||
pub rel: f32,
|
||||
|
||||
Reference in New Issue
Block a user