summaryrefslogtreecommitdiffstats
path: root/widget/src/vertical_slider.rs
diff options
context:
space:
mode:
Diffstat (limited to 'widget/src/vertical_slider.rs')
-rw-r--r--widget/src/vertical_slider.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/widget/src/vertical_slider.rs b/widget/src/vertical_slider.rs
index defb442f..03ec374c 100644
--- a/widget/src/vertical_slider.rs
+++ b/widget/src/vertical_slider.rs
@@ -5,6 +5,7 @@ pub use crate::slider::{
default, Catalog, Handle, HandleShape, Status, Style, StyleFn,
};
+use crate::core::border::Border;
use crate::core::event::{self, Event};
use crate::core::keyboard;
use crate::core::keyboard::key::{self, Key};
@@ -14,8 +15,8 @@ use crate::core::renderer;
use crate::core::touch;
use crate::core::widget::tree::{self, Tree};
use crate::core::{
- self, Border, Clipboard, Element, Length, Pixels, Point, Rectangle, Shell,
- Size, Widget,
+ self, Clipboard, Element, Length, Pixels, Point, Rectangle, Shell, Size,
+ Widget,
};
/// An vertical bar and a handle that selects a single value from a range of
@@ -71,8 +72,8 @@ where
/// * an inclusive range of possible values
/// * the current value of the [`VerticalSlider`]
/// * a function that will be called when the [`VerticalSlider`] is dragged.
- /// It receives the new value of the [`VerticalSlider`] and must produce a
- /// `Message`.
+ /// It receives the new value of the [`VerticalSlider`] and must produce a
+ /// `Message`.
pub fn new<F>(range: RangeInclusive<T>, value: T, on_change: F) -> Self
where
F: 'a + Fn(T) -> Message,
@@ -239,7 +240,7 @@ where
let steps = (percent * (end - start) / step).round();
let value = steps * step + start;
- T::from_f64(value)
+ T::from_f64(value.min(end))
};
new_value
@@ -412,10 +413,10 @@ where
width: style.rail.width,
height: offset + handle_width / 2.0,
},
- border: Border::rounded(style.rail.border_radius),
+ border: style.rail.border,
..renderer::Quad::default()
},
- style.rail.colors.1,
+ style.rail.backgrounds.1,
);
renderer.fill_quad(
@@ -426,10 +427,10 @@ where
width: style.rail.width,
height: bounds.height - offset - handle_width / 2.0,
},
- border: Border::rounded(style.rail.border_radius),
+ border: style.rail.border,
..renderer::Quad::default()
},
- style.rail.colors.0,
+ style.rail.backgrounds.0,
);
renderer.fill_quad(
@@ -447,7 +448,7 @@ where
},
..renderer::Quad::default()
},
- style.handle.color,
+ style.handle.background,
);
}