Timeline: a press in the time ruler moves the current time (#284)

The ruler moved the current-time indicator only once the pointer had
dragged past egui's drag threshold, or on release for a click. As in
After Effects, the time now jumps to the pointer as soon as the button
goes down in the ruler, then follows the drag.

Test: a_press_in_the_ruler_moves_the_current_time (ui_timeline_zoom).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-09 16:59:53 +07:00
co-authored by Claude Opus 5.5
parent 5742a5c567
commit 2419605cc4
2 changed files with 31 additions and 2 deletions
+3 -2
View File
@@ -1320,9 +1320,10 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
}
s += secs_per_label;
}
// Scrub in the ruler.
// Scrub in the ruler: the current time jumps to the pointer as soon as the button goes down
// (After Effects), then follows it.
let rresp = ui.interact(Rect::from_min_max(pos2(graph_x0, ruler.min.y + 12.0), ruler.max), egui::Id::new("tl-ruler"), Sense::click_and_drag());
if (rresp.dragged() || rresp.clicked())
if ((rresp.is_pointer_button_down_on() && ui.input(|i| i.pointer.primary_down())) || rresp.clicked())
&& let Some(pt) = rresp.interact_pointer_pos()
{
let mut secs = tm.t(pt.x).max(0.0);