pub use iced_audio::Knob;
pub mod style {
use iced_audio::graphics::knob::{Appearance, NotchShape, StyleLength};
use iced_audio::knob::ValueArcAppearance;
use iced_style::Theme;
use crate::colors::Colors;
pub struct Knob;
impl iced_audio::knob::StyleSheet for Knob {
type Style = Theme;
fn active(&self, _style: &Self::Style) -> Appearance {
Appearance::Arc(iced_audio::style::knob::ArcAppearance {
width: StyleLength::Fixed(3.),
empty_color: Colors::background_level0(),
filled_color: Colors::active_border_color(),
notch: Knob::notch(),
cap: Default::default(),
})
}
fn hovered(&self, _style: &Self::Style) -> Appearance {
Appearance::Arc(iced_audio::style::knob::ArcAppearance {
width: StyleLength::Fixed(3.),
empty_color: Colors::background_level0(),
filled_color: Colors::active_border_color(),
notch: Knob::notch(),
cap: Default::default(),
})
}
fn dragging(&self, _style: &Self::Style) -> Appearance {
Appearance::Arc(iced_audio::style::knob::ArcAppearance {
width: StyleLength::Fixed(3.),
empty_color: Colors::background_level0(),
filled_color: Colors::active_border_color(),
notch: Knob::notch(),
cap: Default::default(),
})
}
fn value_arc_appearance(&self, _style: &Self::Style) -> Option<ValueArcAppearance> {
Some(ValueArcAppearance {
width: 1.0,
offset: 0.0,
empty_color: Some(Colors::background_level0()),
left_filled_color: Default::default(),
right_filled_color: None,
cap: Default::default(),
})
}
}
impl Knob {
fn notch() -> NotchShape {
NotchShape::Line(iced_audio::style::knob::LineNotch {
color: Colors::background_level0(),
width: StyleLength::Scaled(0.1),
length: StyleLength::Scaled(0.4),
cap: Default::default(),
offset: StyleLength::Fixed(0.),
})
}
}
}