chore: restructured the project

docs: added contributing guidelines and updated rreadme
This commit is contained in:
2025-11-21 00:31:19 +03:00
parent 2db5eb3d76
commit 14a143708f
13 changed files with 657 additions and 438 deletions

41
src/config.rs Normal file
View File

@@ -0,0 +1,41 @@
use crate::style::{KnobColors, KnobStyle, LabelPosition};
pub struct KnobConfig {
pub(crate) size: f32,
pub(crate) font_size: f32,
pub(crate) stroke_width: f32,
pub(crate) colors: KnobColors,
pub(crate) label: Option<String>,
pub(crate) label_position: LabelPosition,
pub(crate) style: KnobStyle,
pub(crate) label_offset: f32,
pub(crate) label_format: Box<dyn Fn(f32) -> String>,
pub(crate) step: Option<f32>,
pub(crate) drag_sensitivity: f32,
pub(crate) show_background_arc: bool,
pub(crate) show_filled_segments: bool,
pub(crate) min_angle: f32,
pub(crate) max_angle: f32,
}
impl KnobConfig {
pub fn new(style: KnobStyle) -> Self {
Self {
size: 40.0,
font_size: 12.0,
stroke_width: 2.0,
colors: KnobColors::default(),
label: None,
label_position: LabelPosition::Bottom,
style,
label_offset: 1.0,
label_format: Box::new(|v| format!("{:.2}", v)),
step: None,
min_angle: -std::f32::consts::PI,
max_angle: std::f32::consts::PI * 0.5,
drag_sensitivity: 0.005,
show_background_arc: true,
show_filled_segments: true,
}
}
}