feat(core/ui): ability to shift marquee vertically
What changed, and why it matters
This commit adds a small UI feature to the Trezor firmware: the ability to vertically shift the position of scrolling text (a 'marquee'). It introduces a new y_offset setting and makes the constructor a compile-time constant. There is no security relevance visible in the code change.
No security action needed. This is a routine UI feature commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies core/embed/rust/src/ui/component/marquee.rs. It adds a y_offset: i16 field to the Marquee struct, initializes it to 0, adds a set_y_offset() setter, and uses it when computing the text rendering position in render_anim(). The Marquee::new constructor is also changed to pub const fn. These are purely presentational changes to the UI component.
Changed components
core/embed/rust/src/ui/component/marquee.rsInspect captured patch +8 / −2
diff --git a/core/embed/rust/src/ui/component/marquee.rs b/core/embed/rust/src/ui/component/marquee.rs
index 7c7ef5a6e..f69b54055 100644
--- a/core/embed/rust/src/ui/component/marquee.rs
+++ b/core/embed/rust/src/ui/component/marquee.rs
@@ -24,6 +24,7 @@ enum State {
pub struct Marquee {
area: Rect,
+ y_offset: i16,
pause_timer: Timer,
min_offset: i16,
max_offset: i16,
@@ -37,9 +38,10 @@ pub struct Marquee {
}
impl Marquee {
- pub fn new(text: TString<'static>, font: Font, fg: Color, bg: Color) -> Self {
+ pub const fn new(text: TString<'static>, font: Font, fg: Color, bg: Color) -> Self {
Self {
area: Rect::zero(),
+ y_offset: 0,
pause_timer: Timer::new(),
min_offset: 0,
max_offset: 0,
@@ -53,6 +55,10 @@ impl Marquee {
}
}
+ pub fn set_y_offset(&mut self, y_offset: i16) {
+ self.y_offset = y_offset;
+ }
+
pub fn set_text(&mut self, text: TString<'static>) {
self.text = text;
}
@@ -122,7 +128,7 @@ impl Marquee {
pub fn render_anim<'s>(&'s self, target: &mut impl Renderer<'s>, offset: i16) {
target.in_window(self.area, &|target| {
let text_height = self.font.text_height();
- let pos = self.area.top_left() + Offset::new(offset, text_height - 1);
+ let pos = self.area.top_left() + Offset::new(offset, text_height - 1 + self.y_offset);
self.text.map(|t| {
shape::Text::new(pos, t, self.font)
.with_fg(self.fg)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.