Merge pull request #774 from vangel76/gap-proportional-scrubbing
#770: Proportional Scrubbing of Timeline values (Ctrl+Alt / Cmd+Opt) # Conflicts: # docs/ui-parity.md
This commit is contained in:
@@ -3546,8 +3546,14 @@ fn value_editor(
|
||||
// With several layers selected the edit applies to all of them (#491): a scrub by the same
|
||||
// change, a typed value as it is.
|
||||
let scrub = ui.ctx().dragged_id().is_some() && ui.input(|i| i.pointer.is_decidedly_dragging());
|
||||
// Proportional Scrubbing (After Effects 26.2): Ctrl+Alt (Cmd+Opt) spreads the change over the
|
||||
// selected layers by selection order, the first unchanged and the last by all of it.
|
||||
let proportional = scrub && ui.input(|i| widgets::proportional_scrub(i.modifiers));
|
||||
let set = |actions: &mut Vec<(String, serde_json::Value)>, v: serde_json::Value| {
|
||||
actions.push(("prop.set".into(), json!({"layer": layer.id.0, "prop": uid, "value": v, "merge": merge, "selected": true, "offset": scrub})))
|
||||
actions.push((
|
||||
"prop.set".into(),
|
||||
json!({"layer": layer.id.0, "prop": uid, "value": v, "merge": merge, "selected": true, "offset": scrub, "proportional": proportional}),
|
||||
))
|
||||
};
|
||||
let is_3d = layer.is_3d();
|
||||
let mut x = at.x;
|
||||
@@ -3602,8 +3608,8 @@ fn value_editor(
|
||||
dims.push(r);
|
||||
if let Some(nv) = nv {
|
||||
let mut nc = c.clone();
|
||||
// Alt edits one value of a linked pair.
|
||||
let shown = if linked && !ui.input(|i| i.modifiers.alt) { n.min(c.len()) } else { 1 };
|
||||
// Alt edits one value of a linked pair (Ctrl+Alt is a proportional scrub).
|
||||
let shown = if linked && !ui.input(|i| i.modifiers.alt && !widgets::proportional_scrub(i.modifiers)) { n.min(c.len()) } else { 1 };
|
||||
let from = if shown == 1 { d } else { 0 };
|
||||
for (e, v) in widgets::constrained(c.get(from..from + shown).unwrap_or_default(), d - from, nv).into_iter().enumerate() {
|
||||
if let Some(slot) = nc.get_mut(from + e) {
|
||||
|
||||
@@ -121,7 +121,7 @@ pub fn hot_number_at(
|
||||
let mult = ui.input(|i| {
|
||||
if i.modifiers.shift {
|
||||
10.0
|
||||
} else if i.modifiers.command {
|
||||
} else if i.modifiers.command && !proportional_scrub(i.modifiers) {
|
||||
0.1
|
||||
} else {
|
||||
1.0
|
||||
@@ -138,6 +138,13 @@ pub fn hot_number_at(
|
||||
(rect, out, resp.drag_stopped())
|
||||
}
|
||||
|
||||
/// Ctrl+Alt (Cmd+Opt on macOS) held while scrubbing hot text: After Effects' Proportional
|
||||
/// Scrubbing, which spreads the change over the selected layers by selection order. Ctrl alone
|
||||
/// still scrubs finely and Shift by tens.
|
||||
pub fn proportional_scrub(m: egui::Modifiers) -> bool {
|
||||
m.command && m.alt
|
||||
}
|
||||
|
||||
/// [`hot_number_at`] for a whole number (an angle's revolutions): a drag steps it once every
|
||||
/// `1 / speed` pixels however slowly the pointer moves (the fractions add up between frames),
|
||||
/// and a typed value is truncated. Returns (rect, Some(new value) when changed, drag finished).
|
||||
|
||||
Reference in New Issue
Block a user