1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-24 21:32:03 +00:00

feat(eckhart): expand touch area of ActionBar

This commit is contained in:
obrusvit 2025-02-17 22:29:05 +01:00 committed by Vít Obrusník
parent b26484f5d1
commit e1cfb7a20b

View File

@ -2,7 +2,7 @@ use crate::{
translations::TR, translations::TR,
ui::{ ui::{
component::{Component, Event, EventCtx}, component::{Component, Event, EventCtx},
geometry::{Alignment2D, Offset, Rect}, geometry::{Alignment2D, Insets, Offset, Rect},
shape::{self, Renderer}, shape::{self, Renderer},
util::{animation_disabled, Pager}, util::{animation_disabled, Pager},
}, },
@ -58,6 +58,7 @@ impl ActionBar {
/// TODO: use this offset /// TODO: use this offset
/// offset for button content to move it towards center /// offset for button content to move it towards center
const BUTTON_CONTENT_OFFSET: Offset = Offset::x(12); // [px] const BUTTON_CONTENT_OFFSET: Offset = Offset::x(12); // [px]
const BUTTON_EXPAND_TOUCH: Insets = Insets::top(Self::ACTION_BAR_HEIGHT);
const PAGINATE_LEFT_CONTENT: ButtonContent = ButtonContent::Icon(theme::ICON_CHEVRON_UP); const PAGINATE_LEFT_CONTENT: ButtonContent = ButtonContent::Icon(theme::ICON_CHEVRON_UP);
const PAGINATE_RIGHT_CONTENT: ButtonContent = ButtonContent::Icon(theme::ICON_CHEVRON_DOWN); const PAGINATE_RIGHT_CONTENT: ButtonContent = ButtonContent::Icon(theme::ICON_CHEVRON_DOWN);
@ -65,7 +66,11 @@ impl ActionBar {
/// Create action bar with single button confirming the layout /// Create action bar with single button confirming the layout
pub fn new_single(button: Button) -> Self { pub fn new_single(button: Button) -> Self {
Self::new(Mode::Single, None, button) Self::new(
Mode::Single,
None,
button.with_expanded_touch_area(Self::BUTTON_EXPAND_TOUCH),
)
} }
/// Create action bar with cancel and confirm buttons. The component /// Create action bar with cancel and confirm buttons. The component
@ -76,8 +81,8 @@ impl ActionBar {
Mode::Double { Mode::Double {
pager: Pager::single_page(), pager: Pager::single_page(),
}, },
Some(left), Some(left.with_expanded_touch_area(Self::BUTTON_EXPAND_TOUCH)),
right, right.with_expanded_touch_area(Self::BUTTON_EXPAND_TOUCH),
) )
} }