1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
use std::fmt::write;
use crate::animation::Interpolator;
use crate::entity::Entity;
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MaxWidth(pub f32);
impl Default for MaxWidth {
fn default() -> Self {
MaxWidth(std::f32::INFINITY)
}
}
impl Interpolator for MaxWidth {
fn interpolate(start: &Self, end: &Self, t: f32) -> Self {
MaxWidth(start.0 + (end.0 - start.0) * t)
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MaxHeight(pub f32);
impl Default for MaxHeight {
fn default() -> Self {
MaxHeight(std::f32::INFINITY)
}
}
impl Interpolator for MaxHeight {
fn interpolate(start: &Self, end: &Self, t: f32) -> Self {
MaxHeight(start.0 + (end.0 - start.0) * t)
}
}
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum Justify {
Start,
Center,
End,
}
impl Default for Justify {
fn default() -> Self {
Justify::Start
}
}
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum Align {
Start,
Center,
End,
}
impl Default for Align {
fn default() -> Self {
Align::Center
}
}
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Overflow {
Visible,
Hidden,
}
impl Default for Overflow {
fn default() -> Self {
Overflow::Hidden
}
}