1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-27 00:28:10 +00:00

fix(core/ui): missing swipe event when animations disabled

This commit is contained in:
Martin Milata 2024-05-24 17:10:45 +02:00
parent bd8ce6e55d
commit cbcd9dd8bd

View File

@ -55,16 +55,21 @@ impl<Q: FlowState, S: FlowStore> SwipeFlow<Q, S> {
}
fn goto(&mut self, ctx: &mut EventCtx, direction: SwipeDirection, state: Q) {
if state == self.state {
self.transition = Transition::Internal;
return;
}
if util::animation_disabled() {
if state == self.state {
assert!(self
.store
.map_swipable(state.index(), |s| s.swipe_finished()));
}
self.state = state;
self.store.event(state.index(), ctx, Event::Attach);
ctx.request_paint();
return;
}
if state == self.state {
self.transition = Transition::Internal;
return;
}
self.transition = Transition::External {
prev_state: self.state,
animation: Animation::new(0.0f32, 1.0f32, util::SLIDE_DURATION_MS, Instant::now()),