mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-11 16:31:42 +00:00
Viewer: clicking the current-time display opens Go to Time (#3373)
The time display in the Composition panel's bottom bar only reacted to Ctrl/Cmd+click, which switches timecode and frames. A plain click now opens the Go to Time dialog (View > Go to Time), as in After Effects. The Ctrl/Cmd+click test follows: its plain click now opens the dialog, which it closes.
This commit is contained in:
@@ -981,6 +981,7 @@ fn bottom_bar_contents(app: &mut EffectcraftApp, ui: &mut egui::Ui, bar: Rect, z
|
||||
}
|
||||
app.auto.add_response("viewer.timecode", &resp, "Current time");
|
||||
crate::panels::toggle_time_display(app, &resp);
|
||||
go_to_time_on_click(app, &resp);
|
||||
// Right: render time.
|
||||
let ms = app.frames.last_ms.lock().map(|v| *v).unwrap_or(0.0);
|
||||
if tr.max.x + 50.0 < bar.max.x {
|
||||
@@ -989,6 +990,14 @@ fn bottom_bar_contents(app: &mut EffectcraftApp, ui: &mut egui::Ui, bar: Rect, z
|
||||
(tr.right() + 8.0 - bar.left()).max(bar.width())
|
||||
}
|
||||
|
||||
/// A plain click on the time display opens Go to Time, as it does in After Effects; Ctrl/Cmd+click
|
||||
/// is [`crate::panels::toggle_time_display`] (#3373).
|
||||
fn go_to_time_on_click(app: &mut EffectcraftApp, resp: &egui::Response) {
|
||||
if resp.clicked() && !resp.ctx.input(|i| i.modifiers.command) {
|
||||
crate::panels::forms::open_form(app, "time.set", &json!({}));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -438,8 +438,11 @@ fn ctrl_click_on_the_time_display_toggles_timecode_and_frames() {
|
||||
click_with(&mut h, at, Modifiers::COMMAND);
|
||||
assert_eq!(style(&h), TimeDisplayStyle::Timecode);
|
||||
assert_eq!(shown(&h, "timeline.timecode"), "0:00:01:06");
|
||||
// A plain click changes nothing.
|
||||
// A plain click leaves the display alone: it opens Go to Time (#3373), closed here.
|
||||
click_with(&mut h, at, Modifiers::NONE);
|
||||
assert_eq!(style(&h), TimeDisplayStyle::Timecode);
|
||||
key(&mut h, Key::Escape);
|
||||
assert!(h.query_by_label("Go to Time").is_none(), "Go to Time closed");
|
||||
let at = center(&h, "timeline.timecode");
|
||||
click_with(&mut h, at, Modifiers::NONE);
|
||||
assert_eq!(style(&h), TimeDisplayStyle::Timecode);
|
||||
@@ -746,3 +749,17 @@ fn typing_one_component_with_several_layers_selected_keeps_their_other_component
|
||||
assert_eq!(pos(&h, a), [40.0, 50.0, -300.0]);
|
||||
assert_eq!(pos(&h, b), [200.0, 120.0, -300.0], "B keeps its own X and Y");
|
||||
}
|
||||
|
||||
/// #3373: a click on the Composition panel's time display opens Go to Time, as in After Effects;
|
||||
/// Ctrl/Cmd+click still switches between timecode and frames.
|
||||
#[test]
|
||||
fn clicking_the_viewer_time_display_opens_go_to_time() {
|
||||
let (mut h, _) = harness();
|
||||
h.state_mut().session.execute("time.set", json!({"frame": 30})).unwrap();
|
||||
h.run_steps(2);
|
||||
assert!(h.query_by_label("Go to Time").is_none(), "set up: no dialog yet");
|
||||
let at = center(&h, "viewer.timecode");
|
||||
click(&mut h, at, 1);
|
||||
h.run_steps(2);
|
||||
assert!(h.query_by_label("Go to Time").is_some(), "the dialog is open");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user