mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-14 09:20:55 +00:00
chore(core/rust): make info button wider
[no changelog]
This commit is contained in:
parent
9cd59105c1
commit
570ffe2c0d
@ -93,7 +93,7 @@ impl<'a> Confirm<'a> {
|
|||||||
if showing_info_screen {
|
if showing_info_screen {
|
||||||
ButtonLayout::arrow_none_none()
|
ButtonLayout::arrow_none_none()
|
||||||
} else if has_info_screen {
|
} else if has_info_screen {
|
||||||
ButtonLayout::cancel_armed_text(button_text, "i")
|
ButtonLayout::cancel_armed_info(button_text)
|
||||||
} else {
|
} else {
|
||||||
ButtonLayout::cancel_none_text(button_text)
|
ButtonLayout::cancel_none_text(button_text)
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,8 @@ where
|
|||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
let offset_x = if style.with_outline {
|
// Moving text to the right.
|
||||||
|
let mut offset_x = if style.with_outline {
|
||||||
theme::BUTTON_OUTLINE
|
theme::BUTTON_OUTLINE
|
||||||
} else if style.with_arms {
|
} else if style.with_arms {
|
||||||
theme::ARMS_MARGIN
|
theme::ARMS_MARGIN
|
||||||
@ -162,6 +163,14 @@ where
|
|||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Centering the text in case of fixed width.
|
||||||
|
if let ButtonContent::Text(text) = &self.content {
|
||||||
|
if let Some(fixed_width) = style.fixed_width {
|
||||||
|
let diff = fixed_width - style.font.visible_text_width(text.as_ref());
|
||||||
|
offset_x = diff / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.get_current_area().bottom_left() + Offset::new(offset_x, -offset_y)
|
self.get_current_area().bottom_left() + Offset::new(offset_x, -offset_y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -522,12 +531,12 @@ where
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Left cancel, armed text and right text.
|
/// Left cancel, armed text and right info icon/text.
|
||||||
pub fn cancel_armed_text(middle: T, right: T) -> Self {
|
pub fn cancel_armed_info(middle: T) -> Self {
|
||||||
Self::new(
|
Self::new(
|
||||||
Some(ButtonDetails::cancel_icon()),
|
Some(ButtonDetails::cancel_icon()),
|
||||||
Some(ButtonDetails::armed_text(middle)),
|
Some(ButtonDetails::armed_text(middle)),
|
||||||
Some(ButtonDetails::text(right)),
|
Some(ButtonDetails::text("i".into()).with_fixed_width(theme::BUTTON_ICON_WIDTH)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ where
|
|||||||
U: StringType + Clone,
|
U: StringType + Clone,
|
||||||
{
|
{
|
||||||
pub fn new(content: T) -> Self {
|
pub fn new(content: T) -> Self {
|
||||||
let btn_layout = ButtonLayout::cancel_armed_text("CONFIRM".into(), "i".into());
|
let btn_layout = ButtonLayout::cancel_armed_info("CONFIRM".into());
|
||||||
Self {
|
Self {
|
||||||
content: Child::new(content),
|
content: Child::new(content),
|
||||||
buttons: Child::new(ButtonController::new(btn_layout)),
|
buttons: Child::new(ButtonController::new(btn_layout)),
|
||||||
|
Loading…
Reference in New Issue
Block a user