use crate::types::{Fixed, Transform3D};
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct WidgetTransform3D(pub Transform3D);
impl From<Transform3D> for WidgetTransform3D {
fn from(t: Transform3D) -> Self {
Self(t)
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct TransformOrigin {
pub x: Fixed,
pub y: Fixed,
}
impl TransformOrigin {
pub const CENTRE: Self = Self {
x: Fixed::HALF,
y: Fixed::HALF,
};
pub const TOP_LEFT: Self = Self {
x: Fixed::ZERO,
y: Fixed::ZERO,
};
pub fn new(x: impl Into<Fixed>, y: impl Into<Fixed>) -> Self {
Self {
x: x.into(),
y: y.into(),
}
}
}
impl Default for TransformOrigin {
fn default() -> Self {
Self::CENTRE
}
}