mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
fix(core/ui): respect animation_disabled() on T3T1
This commit is contained in:
parent
687d773547
commit
6ddf1c849a
@ -7,6 +7,7 @@ use crate::{
|
||||
flow::base::Swipable,
|
||||
geometry::{Axis, Offset, Rect},
|
||||
shape::Renderer,
|
||||
util,
|
||||
},
|
||||
};
|
||||
|
||||
@ -124,6 +125,15 @@ impl<T: Component + Paginate + Clone> Swipable for SwipePage<T> {
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
self.current = match direction {
|
||||
SwipeDirection::Left | SwipeDirection::Up => (self.current + 1).min(self.pages - 1),
|
||||
SwipeDirection::Right | SwipeDirection::Down => self.current.saturating_sub(1),
|
||||
};
|
||||
if util::animation_disabled() {
|
||||
self.inner.change_page(self.current);
|
||||
ctx.request_paint();
|
||||
return true;
|
||||
}
|
||||
self.transition = Some(Transition {
|
||||
cloned: unwrap!(Gc::new(self.inner.clone())),
|
||||
animation: Animation::new(
|
||||
@ -134,10 +144,6 @@ impl<T: Component + Paginate + Clone> Swipable for SwipePage<T> {
|
||||
),
|
||||
direction,
|
||||
});
|
||||
self.current = match direction {
|
||||
SwipeDirection::Left | SwipeDirection::Up => (self.current + 1).min(self.pages - 1),
|
||||
SwipeDirection::Right | SwipeDirection::Down => self.current.saturating_sub(1),
|
||||
};
|
||||
self.inner.change_page(self.current);
|
||||
ctx.request_anim_frame();
|
||||
ctx.request_paint();
|
||||
|
@ -7,6 +7,7 @@ use crate::{
|
||||
flow::{base::Decision, FlowMsg, FlowState, FlowStore},
|
||||
geometry::{Offset, Rect},
|
||||
shape::Renderer,
|
||||
util,
|
||||
},
|
||||
};
|
||||
|
||||
@ -63,6 +64,12 @@ impl<Q: FlowState, S: FlowStore> SwipeFlow<Q, S> {
|
||||
self.transition = Transition::Internal;
|
||||
return;
|
||||
}
|
||||
if util::animation_disabled() {
|
||||
self.state = state;
|
||||
self.store.event(state.index(), ctx, Event::Attach);
|
||||
ctx.request_paint();
|
||||
return;
|
||||
}
|
||||
self.transition = Transition::External {
|
||||
prev_state: self.state,
|
||||
animation: Animation::new(
|
||||
|
Loading…
Reference in New Issue
Block a user