mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-24 10:37:03 -06:00
Slide show: a click after a long pause plays its step instead of skipping it (#11)
The step clock ran before the frame's input actions were applied. A click that started a step (PlayStep) was timed against the old step_start (when the slide was entered), so after waiting longer than the step's duration the step finished in the same frame: everything appeared at once, without animation. Input actions are now applied before the clock is read. generated with Claude Code
This commit is contained in:
@@ -288,6 +288,12 @@ pub fn ui(app: &mut SlideApp, ui: &mut Ui) {
|
||||
if secondary && !show.ended {
|
||||
actions.push(show.state.prev(&doc));
|
||||
}
|
||||
// Apply input first: a step started by this click must restart the clock before it is read.
|
||||
for a in actions.drain(..) {
|
||||
if !show.apply(a, &doc, now) {
|
||||
keep = false;
|
||||
}
|
||||
}
|
||||
// Step clock.
|
||||
let (step, playing) = (show.state.step, show.state.playing);
|
||||
let t_step = if playing { now - show.step_start } else { 0.0 };
|
||||
|
||||
Reference in New Issue
Block a user