diff --git a/core/embed/rust/src/ui/component/map.rs b/core/embed/rust/src/ui/component/map.rs index 46270abf8..ce1486d7d 100644 --- a/core/embed/rust/src/ui/component/map.rs +++ b/core/embed/rust/src/ui/component/map.rs @@ -51,7 +51,7 @@ where } } -#[cfg(all(feature = "micropython", feature = "touch"))] +#[cfg(all(feature = "micropython", feature = "touch", feature = "new_rendering"))] impl crate::ui::flow::Swipable for MsgMap where T: Component + crate::ui::flow::Swipable, diff --git a/core/embed/rust/src/ui/component/swipe.rs b/core/embed/rust/src/ui/component/swipe.rs index 01c72a6aa..6f6926285 100644 --- a/core/embed/rust/src/ui/component/swipe.rs +++ b/core/embed/rust/src/ui/component/swipe.rs @@ -24,10 +24,8 @@ impl SwipeDirection { } } -/// Copy of `model_tt/component/swipe.rs` but without the backlight handling. #[derive(Clone)] pub struct Swipe { - pub area: Rect, pub allow_up: bool, pub allow_down: bool, pub allow_left: bool, @@ -42,7 +40,6 @@ impl Swipe { pub fn new() -> Self { Self { - area: Rect::zero(), allow_up: false, allow_down: false, allow_left: false, @@ -92,8 +89,7 @@ impl Component for Swipe { type Msg = SwipeDirection; fn place(&mut self, bounds: Rect) -> Rect { - self.area = bounds; - self.area + bounds } fn event(&mut self, _ctx: &mut EventCtx, event: Event) -> Option { @@ -101,7 +97,7 @@ impl Component for Swipe { return None; } match (event, self.origin) { - (Event::Touch(TouchEvent::TouchStart(pos)), _) if self.area.contains(pos) => { + (Event::Touch(TouchEvent::TouchStart(pos)), _) => { // Mark the starting position of this touch. self.origin.replace(pos); } diff --git a/core/embed/rust/src/ui/flow/page.rs b/core/embed/rust/src/ui/flow/page.rs index 0e5e5cbcd..8f6f84fef 100644 --- a/core/embed/rust/src/ui/flow/page.rs +++ b/core/embed/rust/src/ui/flow/page.rs @@ -142,7 +142,7 @@ impl Swipable for SwipePage { } self.transition = Some(Transition { cloned: unwrap!(Gc::new(self.inner.clone())), - animation: Animation::new(0.0f32, 1.0f32, util::SLIDE_DURATION, Instant::now()), + animation: Animation::new(0.0f32, 1.0f32, util::SLIDE_DURATION_MS, Instant::now()), direction, }); self.inner.change_page(self.current); diff --git a/core/embed/rust/src/ui/flow/swipe.rs b/core/embed/rust/src/ui/flow/swipe.rs index d2310f52e..252e07a04 100644 --- a/core/embed/rust/src/ui/flow/swipe.rs +++ b/core/embed/rust/src/ui/flow/swipe.rs @@ -67,7 +67,7 @@ impl SwipeFlow { } self.transition = Transition::External { prev_state: self.state, - animation: Animation::new(0.0f32, 1.0f32, util::SLIDE_DURATION, Instant::now()), + animation: Animation::new(0.0f32, 1.0f32, util::SLIDE_DURATION_MS, Instant::now()), direction, }; self.state = state; diff --git a/core/embed/rust/src/ui/lerp.rs b/core/embed/rust/src/ui/lerp.rs index 3daa8d527..1f91efd2c 100644 --- a/core/embed/rust/src/ui/lerp.rs +++ b/core/embed/rust/src/ui/lerp.rs @@ -25,7 +25,7 @@ pub trait InvLerp: Copy { fn inv_lerp(min: Self, max: Self, value: Self) -> f32; } -macro_rules! impl_lerp_for_int { +macro_rules! impl_lerp_for_signed { ($int: ident) => { impl Lerp for $int { fn lerp(a: Self, b: Self, t: f32) -> Self { @@ -41,7 +41,7 @@ macro_rules! impl_lerp_for_int { }; } -macro_rules! impl_lerp_for_uint { +macro_rules! impl_lerp_for_unsigned { ($uint: ident) => { impl Lerp for $uint { fn lerp(a: Self, b: Self, t: f32) -> Self { @@ -65,13 +65,13 @@ macro_rules! impl_lerp_for_uint { }; } -impl_lerp_for_int!(i16); -impl_lerp_for_int!(i32); -impl_lerp_for_uint!(u8); -impl_lerp_for_uint!(u16); -impl_lerp_for_uint!(u32); +impl_lerp_for_signed!(i16); +impl_lerp_for_signed!(i32); +impl_lerp_for_unsigned!(u8); +impl_lerp_for_unsigned!(u16); +impl_lerp_for_unsigned!(u32); -impl_lerp_for_int!(f32); +impl_lerp_for_signed!(f32); #[cfg(test)] mod tests { diff --git a/core/embed/rust/src/ui/mod.rs b/core/embed/rust/src/ui/mod.rs index 9e1518c8a..f68d521fc 100644 --- a/core/embed/rust/src/ui/mod.rs +++ b/core/embed/rust/src/ui/mod.rs @@ -7,7 +7,7 @@ pub mod component; pub mod constant; pub mod display; pub mod event; -#[cfg(all(feature = "micropython", feature = "touch"))] +#[cfg(all(feature = "micropython", feature = "touch", feature = "new_rendering"))] pub mod flow; pub mod geometry; pub mod lerp; diff --git a/core/embed/rust/src/ui/model_mercury/component/share_words.rs b/core/embed/rust/src/ui/model_mercury/component/share_words.rs index 8d681f5d8..e8aba1a7d 100644 --- a/core/embed/rust/src/ui/model_mercury/component/share_words.rs +++ b/core/embed/rust/src/ui/model_mercury/component/share_words.rs @@ -17,7 +17,7 @@ use crate::{ use heapless::{String, Vec}; const MAX_WORDS: usize = 33; // super-shamir has 33 words, all other have less -const ANIMATION_DURATION: Duration = Duration::from_millis(166); +const ANIMATION_DURATION_MS: Duration = Duration::from_millis(166); /// Component showing mnemonic/share words during backup procedure. Model T3T1 /// contains one word per screen. A user is instructed to swipe up/down to see @@ -180,7 +180,7 @@ impl<'a> Swipable for ShareWords<'a> { self.animation = Some(Animation::new( 0.0f32, 1.0f32, - ANIMATION_DURATION, + ANIMATION_DURATION_MS, Instant::now(), )); ctx.request_anim_frame(); diff --git a/core/embed/rust/src/ui/util.rs b/core/embed/rust/src/ui/util.rs index f5b427b9b..e27b94c1f 100644 --- a/core/embed/rust/src/ui/util.rs +++ b/core/embed/rust/src/ui/util.rs @@ -180,7 +180,7 @@ macro_rules! include_icon { }; } -pub const SLIDE_DURATION: Duration = Duration::from_millis(333); +pub const SLIDE_DURATION_MS: Duration = Duration::from_millis(333); #[cfg(feature = "new_rendering")] pub fn render_slide<'s, F0, F1, R>(