move widgets on draw if region size is same

This commit is contained in:
2025-09-27 16:11:30 -04:00
parent 5f2dffc189
commit 95f049acb4
13 changed files with 204 additions and 176 deletions

View File

@@ -1,6 +1,6 @@
use crate::{
layout::UiNum,
util::{F32Util, impl_op},
util::{DivOr, impl_op},
};
use std::ops::*;
@@ -23,15 +23,6 @@ impl Vec2 {
Self { x, y }
}
pub const fn lerp(self, from: impl const Into<Self>, to: impl const Into<Self>) -> Self {
let from = from.into();
let to = to.into();
Self {
x: self.x.lerp(from.x, to.x),
y: self.y.lerp(from.y, to.y),
}
}
pub const fn round(self) -> Self {
Self {
x: self.x.round(),
@@ -69,6 +60,15 @@ impl_op!(Vec2 Sub sub; x y);
impl_op!(Vec2 Mul mul; x y);
impl_op!(Vec2 Div div; x y);
impl const DivOr for Vec2 {
fn div_or(self, rhs: Self, other: Self) -> Self {
Self {
x: self.x.div_or(rhs.x, other.x),
y: self.y.div_or(rhs.y, other.y),
}
}
}
impl Neg for Vec2 {
type Output = Self;