mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-17 01:52:02 +00:00
feat(core): respect disable animations in hold to confirm
[no changelog]
This commit is contained in:
parent
c8c7001301
commit
47a2661736
@ -8,6 +8,7 @@ use crate::{
|
|||||||
lerp::Lerp,
|
lerp::Lerp,
|
||||||
shape,
|
shape,
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
|
util::animation_disabled,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -40,6 +41,10 @@ impl HoldToConfirmAnim {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn eval(&self) -> f32 {
|
pub fn eval(&self) -> f32 {
|
||||||
|
if animation_disabled() {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
self.timer.elapsed().to_millis() as f32 / 1000.0
|
self.timer.elapsed().to_millis() as f32 / 1000.0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,6 +215,11 @@ impl Component for HoldToConfirm {
|
|||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
Some(ButtonMsg::Clicked) => {
|
Some(ButtonMsg::Clicked) => {
|
||||||
|
if animation_disabled() {
|
||||||
|
#[cfg(feature = "haptic")]
|
||||||
|
haptic::play(HapticEffect::HoldToConfirm);
|
||||||
|
return Some(());
|
||||||
|
}
|
||||||
self.anim.reset();
|
self.anim.reset();
|
||||||
ctx.request_anim_frame();
|
ctx.request_anim_frame();
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
|
Loading…
Reference in New Issue
Block a user