Regler, Schalter und Tempo-Display melden Namen und Wert (#1070)
Die selbstgezeichneten Elemente waren für Barrierefreiheit und kittest unsichtbar. Neue Tests: Namen, Klick auf einen Schalter, gesperrter Schalter, Tempo-Anzeige; sie scheitern gegen die alte gear.rs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
//! Bedienelemente im Stil von Musikgeräten: Frontplatte mit Schrauben, Drehregler, Kippschalter mit LED,
|
||||
//! LED-Pegelkette. Die Mathematik (Winkel, Ziehen, LED-Anzahl) ist rein und getestet.
|
||||
|
||||
use eframe::egui::{self, Align2, Color32, FontId, Rect, Response, Sense, Stroke, Ui, pos2, vec2};
|
||||
use eframe::egui::{
|
||||
self, Align2, Color32, FontId, Rect, Response, Role, Sense, Stroke, Ui, WidgetInfo, pos2, vec2,
|
||||
};
|
||||
|
||||
/// Warmes Bernstein als Akzent (Beleuchtung, aktive Elemente).
|
||||
pub const AMBER: Color32 = Color32::from_rgb(255, 176, 48);
|
||||
@ -305,6 +307,8 @@ pub fn knob_sized(
|
||||
FontId::monospace(12.0),
|
||||
AMBER,
|
||||
);
|
||||
// Name und Wert für Barrierefreiheit und automatische Tests (die Beschriftung ist nur gemalt).
|
||||
resp.widget_info(|| WidgetInfo::slider(enabled, f64::from(*value), label));
|
||||
resp.on_hover_text(format!(
|
||||
"{label}: ziehen oder Mausrad (Umschalt = fein), Doppelklick = zurücksetzen"
|
||||
))
|
||||
@ -381,6 +385,7 @@ pub fn toggle(ui: &mut Ui, on: &mut bool, label: &str, enabled: bool) -> Respons
|
||||
FontId::proportional(14.0),
|
||||
dim(Color32::from_gray(225), alpha),
|
||||
);
|
||||
resp.widget_info(|| WidgetInfo::selected(Role::CheckBox, enabled, *on, label));
|
||||
resp
|
||||
}
|
||||
|
||||
@ -417,6 +422,7 @@ pub fn lcd(ui: &mut Ui, text: &str, caption: &str, color: Color32, width: f32) -
|
||||
FontId::monospace(30.0),
|
||||
color,
|
||||
);
|
||||
resp.widget_info(|| WidgetInfo::labeled(Role::Label, true, format!("{caption}: {text}")));
|
||||
resp
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user