UI: Window > Ease Presets panel draws, edits and applies ease curves (#254)
A dockable panel (our own design) for the keys.easePreset commands. A value graph shows the working curve with its two handles, which drag to edit it; Apply eases the selected keyframes with it and From Keys loads the curve between the first selected pair. Every preset is a thumbnail drawn in code; a click loads it and applies it to the selected keys. Save Current keeps the working curve under the name in the field, and Rename and Delete act on the selected user preset. Wide panels put the presets beside the graph; narrow ones below it, the graph shrinking to leave a row of presets, scrolled with the wheel. The panel state (working curve, selection, name) is serde in the UI state, and every control registers an automation id (easePresets.*). widgets::text_field is the search field without its magnifier. Test: clicking_an_ease_preset_eases_the_selected_keys_and_handles_edit_the_curve (ui_keyframes); every_panel_registers_automation_ids_for_its_widgets covers the new panel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0717f12246
commit
1c22615553
@@ -193,11 +193,22 @@ pub fn text_fit(p: &egui::Painter, pos: egui::Pos2, align: Align2, text: &str, f
|
||||
|
||||
/// Rounded search field with a magnifier icon.
|
||||
pub fn search_field(ui: &mut Ui, rect: Rect, text: &mut String, hint: &str, t: &Tokens) -> Response {
|
||||
field(ui, rect, text, hint, t, true)
|
||||
}
|
||||
|
||||
/// Rounded text field.
|
||||
pub fn text_field(ui: &mut Ui, rect: Rect, text: &mut String, hint: &str, t: &Tokens) -> Response {
|
||||
field(ui, rect, text, hint, t, false)
|
||||
}
|
||||
|
||||
fn field(ui: &mut Ui, rect: Rect, text: &mut String, hint: &str, t: &Tokens, search: bool) -> Response {
|
||||
let h = rect.height();
|
||||
ui.painter().rect_filled(rect, h / 2.0, t.field_bg);
|
||||
ui.painter().rect_stroke(rect, h / 2.0, Stroke::new(1.0, t.field_border), StrokeKind::Inside);
|
||||
icons::paint(ui.painter(), Rect::from_center_size(pos2(rect.min.x + 12.0, rect.center().y), vec2(12.0, 12.0)), Icon::Search, t.text_dim);
|
||||
let inner = Rect::from_min_max(pos2(rect.min.x + 22.0, rect.min.y + 1.0), pos2(rect.max.x - 8.0, rect.max.y - 1.0));
|
||||
if search {
|
||||
icons::paint(ui.painter(), Rect::from_center_size(pos2(rect.min.x + 12.0, rect.center().y), vec2(12.0, 12.0)), Icon::Search, t.text_dim);
|
||||
}
|
||||
let inner = Rect::from_min_max(pos2(rect.min.x + if search { 22.0 } else { 9.0 }, rect.min.y + 1.0), pos2(rect.max.x - 8.0, rect.max.y - 1.0));
|
||||
let mut child = ui.new_child(egui::UiBuilder::new().max_rect(inner));
|
||||
child.add(
|
||||
egui::TextEdit::singleline(text)
|
||||
|
||||
Reference in New Issue
Block a user