1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 17:38:39 +00:00

feat(core): respect disable animations in hold to confirm

[no changelog]
This commit is contained in:
tychovrahe 2024-05-29 12:08:30 +02:00 committed by TychoVrahe
parent c8c7001301
commit 47a2661736

View File

@ -8,6 +8,7 @@ use crate::{
lerp::Lerp,
shape,
shape::Renderer,
util::animation_disabled,
},
};
@ -40,6 +41,10 @@ impl HoldToConfirmAnim {
}
pub fn eval(&self) -> f32 {
if animation_disabled() {
return 0.0;
}
self.timer.elapsed().to_millis() as f32 / 1000.0
}
@ -210,6 +215,11 @@ impl Component for HoldToConfirm {
ctx.request_paint();
}
Some(ButtonMsg::Clicked) => {
if animation_disabled() {
#[cfg(feature = "haptic")]
haptic::play(HapticEffect::HoldToConfirm);
return Some(());
}
self.anim.reset();
ctx.request_anim_frame();
ctx.request_paint();