Merge pull request #2163 from hicaru/svg_hover

added svg hover, for styles impl
This commit is contained in:
Héctor Ramón 2024-01-18 03:46:13 +01:00 committed by GitHub
commit 61e3d8502f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 2 deletions

View file

@ -20,4 +20,7 @@ pub trait StyleSheet {
/// Produces the [`Appearance`] of the svg.
fn appearance(&self, style: &Self::Style) -> Appearance;
/// Produces the hovered [`Appearance`] of a svg content.
fn hovered(&self, style: &Self::Style) -> Appearance;
}

View file

@ -939,6 +939,10 @@ impl svg::StyleSheet for Theme {
Svg::Custom(custom) => custom.appearance(self),
}
}
fn hovered(&self, style: &Self::Style) -> svg::Appearance {
self.appearance(style)
}
}
impl svg::StyleSheet for fn(&Theme) -> svg::Appearance {
@ -947,6 +951,10 @@ impl svg::StyleSheet for fn(&Theme) -> svg::Appearance {
fn appearance(&self, style: &Self::Style) -> svg::Appearance {
(self)(style)
}
fn hovered(&self, style: &Self::Style) -> svg::Appearance {
self.appearance(style)
}
}
/// The style of a scrollable.