Merge pull request #1669 from GyulyVGC/master

Added scrollable style `focused` to be displayed when mouse is over the scrollable area
This commit is contained in:
Héctor Ramón 2023-03-27 16:17:02 +02:00 committed by GitHub
commit 4e409bb383
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 76 additions and 38 deletions

View file

@ -338,22 +338,36 @@ impl scrollable::StyleSheet for ScrollbarCustomStyle {
style.active(&theme::Scrollable::Default)
}
fn hovered(&self, style: &Self::Style) -> Scrollbar {
style.hovered(&theme::Scrollable::Default)
fn hovered(
&self,
style: &Self::Style,
is_mouse_over_scrollbar: bool,
) -> Scrollbar {
style.hovered(&theme::Scrollable::Default, is_mouse_over_scrollbar)
}
fn hovered_horizontal(&self, style: &Self::Style) -> Scrollbar {
Scrollbar {
background: style.active(&theme::Scrollable::default()).background,
border_radius: 0.0,
border_width: 0.0,
border_color: Default::default(),
scroller: Scroller {
color: Color::from_rgb8(250, 85, 134),
fn hovered_horizontal(
&self,
style: &Self::Style,
is_mouse_over_scrollbar: bool,
) -> Scrollbar {
if is_mouse_over_scrollbar {
Scrollbar {
background: style
.active(&theme::Scrollable::default())
.background,
border_radius: 0.0,
border_width: 0.0,
border_color: Default::default(),
},
scroller: Scroller {
color: Color::from_rgb8(250, 85, 134),
border_radius: 0.0,
border_width: 0.0,
border_color: Default::default(),
},
}
} else {
self.active(style)
}
}
}