Angles: the revolutions ("0x") scrub and take typing (#93)
An angle's revolutions were painted text: only the degrees could be dragged or typed, so full turns needed the dial or typing past 360. fx_widgets::angle_field draws `0x+45.0°` as two hot numbers: the revolutions (widgets::hot_int_at, ten pixels a turn, fractions adding up between frames so slow drags still step; a typed value is truncated) and the degrees, each keeping the other. Effect Controls, the Timeline and the Properties panel use it, so they read and edit angles alike (the Timeline showed `-1x-40.0°` and Properties had its own split). Automation ids: timeline.prop.<uid>.revolutions, effectControls.prop.<uid>.revolutions, properties.prop.<uid>.revolutions. Regression test: angle_revolutions_scrub_and_take_typing drags and types the revolutions in all three panels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1a9288f83c
commit
27b0eec216
@@ -221,18 +221,11 @@ fn prop_row(
|
||||
}
|
||||
}
|
||||
Value::Scalar(v) if matches!(prop.ui, ParamUi::Angle) => {
|
||||
let (rev, deg) = fw::split_angle(*v);
|
||||
let prefix = format!("{rev}x{}", if deg < 0.0 { "-" } else { "+" });
|
||||
let g = p.layout_no_wrap(prefix, Tokens::ui(12.0), t.hot_text);
|
||||
let gw = g.size().x;
|
||||
p.galley(pos2(vx + 2.0, cy - g.size().y / 2.0), g, t.hot_text);
|
||||
let (vr, nv, _) = widgets::hot_number_at(ui, pos2(vx + gw, cy - 9.0), egui::Id::new(("ec-v", uid)), deg.abs(), 0.5, (-1e9, 1e9), 1, "°", &t);
|
||||
let full = Rect::from_min_max(pos2(vx, vr.min.y), vr.max);
|
||||
app.auto.add(&format!("effectControls.prop.{uid}.value"), full, &fw::format_angle(*v, 1));
|
||||
let (rr, dr, nv) = fw::angle_field(ui, pos2(vx, cy - 9.0), egui::Id::new(("ec-v", uid)), *v, 1, &t);
|
||||
app.auto.add(&format!("effectControls.prop.{uid}.value"), rr.union(dr), &fw::format_angle(*v, 1));
|
||||
app.auto.add(&format!("effectControls.prop.{uid}.revolutions"), rr, &prop.name);
|
||||
if let Some(nv) = nv {
|
||||
// The field edits the degrees part; the revolutions stay.
|
||||
let signed = if deg < 0.0 || (deg == 0.0 && *v < 0.0) { -nv } else { nv };
|
||||
set(actions, json!(rev as f64 * 360.0 + signed));
|
||||
set(actions, json!(nv));
|
||||
}
|
||||
twirl_open(app, ui);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user