summaryrefslogtreecommitdiffstats
path: root/style
diff options
context:
space:
mode:
authorLibravatar bungoboingo <shankern@protonmail.com>2022-12-24 21:27:44 -0800
committerLibravatar bungoboingo <shankern@protonmail.com>2022-12-29 18:29:15 -0800
commit9f85e0c721927f1e3bd195a998ec7a80ec0e7455 (patch)
treeed4bc6f1f700f9570cc9c72428188d506951d80f /style
parentd91f4f6aa74d0693179a02167d626efa3ac4c20b (diff)
downloadiced-9f85e0c721927f1e3bd195a998ec7a80ec0e7455.tar.gz
iced-9f85e0c721927f1e3bd195a998ec7a80ec0e7455.tar.bz2
iced-9f85e0c721927f1e3bd195a998ec7a80ec0e7455.zip
Reworked Scrollable to account for lack of widget order guarantees.
Fixed thumb "snapping" bug on scrollable when cursor is out of bounds.
Diffstat (limited to 'style')
-rw-r--r--style/src/theme.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs
index cef8f2be..f780f952 100644
--- a/style/src/theme.rs
+++ b/style/src/theme.rs
@@ -872,6 +872,15 @@ pub enum Scrollable {
Custom(Box<dyn scrollable::StyleSheet<Style = Theme>>),
}
+impl Scrollable {
+ /// Creates a custom [`Scrollable`] theme.
+ pub fn custom<T: scrollable::StyleSheet<Style = Theme> + 'static>(
+ style: T,
+ ) -> Self {
+ Self::Custom(Box::new(style))
+ }
+}
+
impl scrollable::StyleSheet for Theme {
type Style = Scrollable;