Ensure Float position is in range 0.0..=1.0
This commit is contained in:
parent
caca3b6ef1
commit
e666d5c092
1 changed files with 3 additions and 0 deletions
|
|
@ -19,16 +19,19 @@ impl<I> Float<I> {
|
|||
}
|
||||
|
||||
pub fn horizontal(mut self, position: f32) -> Self {
|
||||
assert!((0.0..=1.0).contains(&position));
|
||||
self.horizontal = Some(position);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn vertical(mut self, position: f32) -> Self {
|
||||
assert!((0.0..=1.0).contains(&position));
|
||||
self.vertical = Some(position);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn all(self, position: f32) -> Self {
|
||||
assert!((0.0..=1.0).contains(&position));
|
||||
self.horizontal(position).vertical(position)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue