pub const KIND: &str = "day.piece.stepper";
pub const VALUE_TAG: &str = "stepper:value";
#[derive(Clone, Debug, PartialEq)]
pub struct StepperProps {
pub value: f64,
pub min: f64,
pub max: f64,
pub step: f64,
pub decimals: u32,
}
impl Default for StepperProps {
fn default() -> Self {
StepperProps {
value: 0.0,
min: 0.0,
max: 100.0,
step: 1.0,
decimals: 0,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum StepperPatch {
SetValue(f64),
}
#[must_use]
pub fn fmt_value(v: f64, decimals: u32) -> String {
format!("{v:.prec$}", prec = decimals as usize)
}