mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 02:09:00 +00:00
Motion: a tween's last step keeps the run from replay without asking for another frame
A tween that moves in a pass leaves its slot in another state than the run found it in, so a record of the run is not replayed; only a tween still running asks for a repaint. The last step of a modal's nudge asked for one more frame, so the dialog nudge trial saw a repaint after the nudge came to rest.
This commit is contained in:
@@ -396,7 +396,8 @@ impl Driver<'_> {
|
||||
let now = frame::clock(ctx);
|
||||
let existing = if sizing { store::peek_clone::<Tween<T>>(ctx, id) } else { store::take::<Tween<T>>(ctx, id) };
|
||||
// A tween that moves in this pass (a new target, also one it jumps to, or a step, also its last one) leaves the
|
||||
// slot in another state than the run found it in, which the next run reads (`layer_fading` among others).
|
||||
// slot in another state than the run found it in, which the next run reads (`layer_fading` among others): a
|
||||
// record of the run is not replayed. Only a tween still running asks for another frame.
|
||||
let moved = existing.as_ref().is_some_and(|tween| tween.target() != target || !tween.is_settled());
|
||||
let mut tween = match existing {
|
||||
Some(tween) => tween,
|
||||
@@ -410,8 +411,10 @@ impl Driver<'_> {
|
||||
self.advance(&mut tween, target, spec, now);
|
||||
let shown = tween.shown();
|
||||
if !sizing {
|
||||
if moved || !tween.is_settled() {
|
||||
if !tween.is_settled() {
|
||||
note_unsettled(ctx);
|
||||
} else if moved {
|
||||
crate::runtime::replay::note_unsettled(ctx);
|
||||
}
|
||||
store::put(ctx, id, tween);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user