[slider] Add Slider::u32
This commit is contained in:
parent
7638ca9962
commit
72285e7954
1 changed files with 12 additions and 0 deletions
|
@ -113,6 +113,18 @@ impl<'a> Slider<'a> {
|
|||
.integer()
|
||||
}
|
||||
|
||||
pub fn u32(value: &'a mut u32, range: RangeInclusive<u32>) -> Self {
|
||||
Self {
|
||||
..Self::from_get_set(to_f64_range(range), move |v: Option<f64>| {
|
||||
if let Some(v) = v {
|
||||
*value = v.round() as u32
|
||||
}
|
||||
*value as f64
|
||||
})
|
||||
}
|
||||
.integer()
|
||||
}
|
||||
|
||||
pub fn usize(value: &'a mut usize, range: RangeInclusive<usize>) -> Self {
|
||||
let range = (*range.start() as f64)..=(*range.end() as f64);
|
||||
Self {
|
||||
|
|
Loading…
Reference in a new issue