mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-27 13:35:44 +00:00
fixup! chore(core): show the last passphrase character for a while
This commit is contained in:
parent
dc65c00243
commit
260468fe83
@ -168,3 +168,13 @@ pub fn render_pill_shape<'s>(
|
|||||||
.with_thickness(2)
|
.with_thickness(2)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `DisplayStyle` isused to determine whether the text is fully hidden, fully
|
||||||
|
/// shown, or partially visible.
|
||||||
|
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||||
|
#[cfg_attr(feature = "ui_debug", derive(ufmt::derive::uDebug))]
|
||||||
|
pub(crate) enum DisplayStyle {
|
||||||
|
Hidden,
|
||||||
|
Shown,
|
||||||
|
LastOnly,
|
||||||
|
}
|
||||||
|
@ -13,7 +13,7 @@ use crate::{
|
|||||||
model_mercury::{
|
model_mercury::{
|
||||||
component::{
|
component::{
|
||||||
button::{Button, ButtonContent, ButtonMsg},
|
button::{Button, ButtonContent, ButtonMsg},
|
||||||
keyboard::common::{render_pending_marker, MultiTapKeyboard},
|
keyboard::common::{render_pending_marker, DisplayStyle, MultiTapKeyboard},
|
||||||
theme,
|
theme,
|
||||||
},
|
},
|
||||||
cshape,
|
cshape,
|
||||||
@ -32,14 +32,6 @@ pub enum PassphraseKeyboardMsg {
|
|||||||
Cancelled,
|
Cancelled,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
|
||||||
#[cfg_attr(feature = "ui_debug", derive(ufmt::derive::uDebug))]
|
|
||||||
enum DisplayStyle {
|
|
||||||
Dots,
|
|
||||||
Chars,
|
|
||||||
LastChar,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Enum keeping track of which keyboard is shown and which comes next. Keep the
|
/// Enum keeping track of which keyboard is shown and which comes next. Keep the
|
||||||
/// number of values and the constant PAGE_COUNT in synch.
|
/// number of values and the constant PAGE_COUNT in synch.
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
@ -415,7 +407,7 @@ impl Component for PassphraseKeyboard {
|
|||||||
// multi tap timer is runnig, the last digit timer should be stopped
|
// multi tap timer is runnig, the last digit timer should be stopped
|
||||||
self.input.last_char_timer.stop();
|
self.input.last_char_timer.stop();
|
||||||
}
|
}
|
||||||
self.input.display_style = DisplayStyle::LastChar;
|
self.input.display_style = DisplayStyle::LastOnly;
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -462,7 +454,7 @@ impl Input {
|
|||||||
area: Rect::zero(),
|
area: Rect::zero(),
|
||||||
textbox: TextBox::empty(MAX_LENGTH),
|
textbox: TextBox::empty(MAX_LENGTH),
|
||||||
multi_tap: MultiTapKeyboard::new(),
|
multi_tap: MultiTapKeyboard::new(),
|
||||||
display_style: DisplayStyle::LastChar,
|
display_style: DisplayStyle::LastOnly,
|
||||||
last_char_timer: Timer::new(),
|
last_char_timer: Timer::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -486,8 +478,8 @@ impl Input {
|
|||||||
// Jiggle hidden passphrase when overflowed.
|
// Jiggle hidden passphrase when overflowed.
|
||||||
if chars > truncated.len()
|
if chars > truncated.len()
|
||||||
&& chars % 2 == 0
|
&& chars % 2 == 0
|
||||||
&& (self.display_style == DisplayStyle::Dots
|
&& (self.display_style == DisplayStyle::Hidden
|
||||||
|| self.display_style == DisplayStyle::LastChar)
|
|| self.display_style == DisplayStyle::LastOnly)
|
||||||
{
|
{
|
||||||
text_baseline.x += Self::TWITCH;
|
text_baseline.x += Self::TWITCH;
|
||||||
}
|
}
|
||||||
@ -516,7 +508,7 @@ impl Input {
|
|||||||
let bullet = theme::ICON_PIN_BULLET.toif;
|
let bullet = theme::ICON_PIN_BULLET.toif;
|
||||||
let mut cursor = area.left_center();
|
let mut cursor = area.left_center();
|
||||||
let all_chars = self.textbox.content().len();
|
let all_chars = self.textbox.content().len();
|
||||||
let last_char = self.display_style == DisplayStyle::LastChar;
|
let last_char = self.display_style == DisplayStyle::LastOnly;
|
||||||
|
|
||||||
if all_chars > 0 {
|
if all_chars > 0 {
|
||||||
// Find out how much text can fit into the textbox.
|
// Find out how much text can fit into the textbox.
|
||||||
@ -533,8 +525,8 @@ impl Input {
|
|||||||
// Jiggle when overflowed.
|
// Jiggle when overflowed.
|
||||||
if all_chars > visible_chars
|
if all_chars > visible_chars
|
||||||
&& all_chars % 2 == 0
|
&& all_chars % 2 == 0
|
||||||
&& (self.display_style == DisplayStyle::Dots
|
&& (self.display_style == DisplayStyle::Hidden
|
||||||
|| self.display_style == DisplayStyle::LastChar)
|
|| self.display_style == DisplayStyle::LastOnly)
|
||||||
{
|
{
|
||||||
cursor.x += Self::TWITCH;
|
cursor.x += Self::TWITCH;
|
||||||
}
|
}
|
||||||
@ -601,15 +593,15 @@ impl Component for Input {
|
|||||||
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
|
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
|
||||||
match event {
|
match event {
|
||||||
Event::Timer(_) if self.last_char_timer.expire(event) => {
|
Event::Timer(_) if self.last_char_timer.expire(event) => {
|
||||||
self.display_style = DisplayStyle::Dots;
|
self.display_style = DisplayStyle::Hidden;
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
Event::Touch(TouchEvent::TouchStart(pos)) if self.area.contains(pos) => {
|
Event::Touch(TouchEvent::TouchStart(pos)) if self.area.contains(pos) => {
|
||||||
self.display_style = DisplayStyle::Chars;
|
self.display_style = DisplayStyle::Shown;
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
Event::Touch(TouchEvent::TouchEnd(pos)) if self.area.contains(pos) => {
|
Event::Touch(TouchEvent::TouchEnd(pos)) if self.area.contains(pos) => {
|
||||||
self.display_style = DisplayStyle::Dots;
|
self.display_style = DisplayStyle::Hidden;
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
@ -626,7 +618,7 @@ impl Component for Input {
|
|||||||
// Paint the passphrase
|
// Paint the passphrase
|
||||||
if !self.textbox.content().is_empty() {
|
if !self.textbox.content().is_empty() {
|
||||||
match self.display_style {
|
match self.display_style {
|
||||||
DisplayStyle::Chars => self.render_chars(text_area, target),
|
DisplayStyle::Shown => self.render_chars(text_area, target),
|
||||||
_ => self.render_dots(text_area, target),
|
_ => self.render_dots(text_area, target),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ use crate::{
|
|||||||
Button, ButtonContent,
|
Button, ButtonContent,
|
||||||
ButtonMsg::{self, Clicked},
|
ButtonMsg::{self, Clicked},
|
||||||
},
|
},
|
||||||
|
keyboard::common::DisplayStyle,
|
||||||
theme,
|
theme,
|
||||||
},
|
},
|
||||||
cshape,
|
cshape,
|
||||||
@ -431,7 +432,7 @@ impl Component for PinKeyboard<'_> {
|
|||||||
}
|
}
|
||||||
// Timeout for showing the last digit.
|
// Timeout for showing the last digit.
|
||||||
Event::Timer(_) if self.timeout_timer.expire(event) => {
|
Event::Timer(_) if self.timeout_timer.expire(event) => {
|
||||||
self.textbox.display_style = DisplayStyle::Dots;
|
self.textbox.display_style = DisplayStyle::Hidden;
|
||||||
self.textbox.request_complete_repaint(ctx);
|
self.textbox.request_complete_repaint(ctx);
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
@ -482,7 +483,7 @@ impl Component for PinKeyboard<'_> {
|
|||||||
self.pin_modified(ctx);
|
self.pin_modified(ctx);
|
||||||
self.timeout_timer
|
self.timeout_timer
|
||||||
.start(ctx, Duration::from_secs(LAST_DIGIT_TIMEOUT_S));
|
.start(ctx, Duration::from_secs(LAST_DIGIT_TIMEOUT_S));
|
||||||
self.textbox.display_style = DisplayStyle::LastDigit;
|
self.textbox.display_style = DisplayStyle::LastOnly;
|
||||||
self.textbox.request_complete_repaint(ctx);
|
self.textbox.request_complete_repaint(ctx);
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
return None;
|
return None;
|
||||||
@ -542,14 +543,6 @@ struct PinDots {
|
|||||||
display_style: DisplayStyle,
|
display_style: DisplayStyle,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
|
||||||
#[cfg_attr(feature = "ui_debug", derive(ufmt::derive::uDebug))]
|
|
||||||
enum DisplayStyle {
|
|
||||||
Dots,
|
|
||||||
Digits,
|
|
||||||
LastDigit,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PinDots {
|
impl PinDots {
|
||||||
const DOT: i16 = 6;
|
const DOT: i16 = 6;
|
||||||
const PADDING: i16 = 7;
|
const PADDING: i16 = 7;
|
||||||
@ -561,7 +554,7 @@ impl PinDots {
|
|||||||
pad: Pad::with_background(style.background_color),
|
pad: Pad::with_background(style.background_color),
|
||||||
style,
|
style,
|
||||||
digits: ShortString::new(),
|
digits: ShortString::new(),
|
||||||
display_style: DisplayStyle::Dots,
|
display_style: DisplayStyle::Hidden,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,14 +688,15 @@ impl Component for PinDots {
|
|||||||
match event {
|
match event {
|
||||||
Event::Touch(TouchEvent::TouchStart(pos)) => {
|
Event::Touch(TouchEvent::TouchStart(pos)) => {
|
||||||
if self.area.contains(pos) {
|
if self.area.contains(pos) {
|
||||||
self.display_style = DisplayStyle::Digits;
|
self.display_style = DisplayStyle::Shown;
|
||||||
self.pad.clear();
|
self.pad.clear();
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
};
|
};
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
Event::Touch(TouchEvent::TouchEnd(_)) => {
|
Event::Touch(TouchEvent::TouchEnd(_)) => {
|
||||||
if mem::replace(&mut self.display_style, DisplayStyle::Dots) == DisplayStyle::Digits
|
if mem::replace(&mut self.display_style, DisplayStyle::Hidden)
|
||||||
|
== DisplayStyle::Shown
|
||||||
{
|
{
|
||||||
self.pad.clear();
|
self.pad.clear();
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
@ -717,9 +711,9 @@ impl Component for PinDots {
|
|||||||
let dot_area = self.area.inset(HEADER_PADDING);
|
let dot_area = self.area.inset(HEADER_PADDING);
|
||||||
self.pad.render(target);
|
self.pad.render(target);
|
||||||
match self.display_style {
|
match self.display_style {
|
||||||
DisplayStyle::Digits => self.render_digits(dot_area, target),
|
DisplayStyle::Shown => self.render_digits(dot_area, target),
|
||||||
DisplayStyle::Dots => self.render_dots(false, dot_area, target),
|
DisplayStyle::Hidden => self.render_dots(false, dot_area, target),
|
||||||
DisplayStyle::LastDigit => self.render_dots(true, dot_area, target),
|
DisplayStyle::LastOnly => self.render_dots(true, dot_area, target),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,3 +137,13 @@ pub fn render_pending_marker<'s>(
|
|||||||
shape::Bar::new(marker_rect).with_bg(color).render(target);
|
shape::Bar::new(marker_rect).with_bg(color).render(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `DisplayStyle` isused to determine whether the text is fully hidden, fully
|
||||||
|
/// shown, or partially visible.
|
||||||
|
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||||
|
#[cfg_attr(feature = "ui_debug", derive(ufmt::derive::uDebug))]
|
||||||
|
pub(crate) enum DisplayStyle {
|
||||||
|
Hidden,
|
||||||
|
Shown,
|
||||||
|
LastOnly,
|
||||||
|
}
|
||||||
|
@ -11,7 +11,7 @@ use crate::{
|
|||||||
geometry::{Alignment, Grid, Offset, Rect},
|
geometry::{Alignment, Grid, Offset, Rect},
|
||||||
model_tt::component::{
|
model_tt::component::{
|
||||||
button::{Button, ButtonContent, ButtonMsg},
|
button::{Button, ButtonContent, ButtonMsg},
|
||||||
keyboard::common::{render_pending_marker, MultiTapKeyboard},
|
keyboard::common::{render_pending_marker, DisplayStyle, MultiTapKeyboard},
|
||||||
swipe::{Swipe, SwipeDirection},
|
swipe::{Swipe, SwipeDirection},
|
||||||
theme, ScrollBar,
|
theme, ScrollBar,
|
||||||
},
|
},
|
||||||
@ -27,14 +27,6 @@ pub enum PassphraseKeyboardMsg {
|
|||||||
Cancelled,
|
Cancelled,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
|
||||||
#[cfg_attr(feature = "ui_debug", derive(ufmt::derive::uDebug))]
|
|
||||||
enum DisplayStyle {
|
|
||||||
Dots,
|
|
||||||
Chars,
|
|
||||||
LastChar,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct PassphraseKeyboard {
|
pub struct PassphraseKeyboard {
|
||||||
page_swipe: Swipe,
|
page_swipe: Swipe,
|
||||||
input: Child<Input>,
|
input: Child<Input>,
|
||||||
@ -324,7 +316,7 @@ impl Component for PassphraseKeyboard {
|
|||||||
self.input.mutate(ctx, |_ctx, t| t.stop_timer());
|
self.input.mutate(ctx, |_ctx, t| t.stop_timer());
|
||||||
}
|
}
|
||||||
self.input
|
self.input
|
||||||
.mutate(ctx, |_ctx, t| t.set_display_style(DisplayStyle::LastChar));
|
.mutate(ctx, |_ctx, t| t.set_display_style(DisplayStyle::LastOnly));
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -364,7 +356,7 @@ impl Input {
|
|||||||
area: Rect::zero(),
|
area: Rect::zero(),
|
||||||
textbox: TextBox::empty(MAX_LENGTH),
|
textbox: TextBox::empty(MAX_LENGTH),
|
||||||
multi_tap: MultiTapKeyboard::new(),
|
multi_tap: MultiTapKeyboard::new(),
|
||||||
display_style: DisplayStyle::LastChar,
|
display_style: DisplayStyle::LastOnly,
|
||||||
last_char_timer: Timer::new(),
|
last_char_timer: Timer::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,15 +386,15 @@ impl Component for Input {
|
|||||||
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
|
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
|
||||||
match event {
|
match event {
|
||||||
Event::Timer(_) if self.last_char_timer.expire(event) => {
|
Event::Timer(_) if self.last_char_timer.expire(event) => {
|
||||||
self.display_style = DisplayStyle::Dots;
|
self.display_style = DisplayStyle::Hidden;
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
Event::Touch(TouchEvent::TouchStart(pos)) if self.area.contains(pos) => {
|
Event::Touch(TouchEvent::TouchStart(pos)) if self.area.contains(pos) => {
|
||||||
self.display_style = DisplayStyle::Chars;
|
self.display_style = DisplayStyle::Shown;
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
Event::Touch(TouchEvent::TouchEnd(pos)) if self.area.contains(pos) => {
|
Event::Touch(TouchEvent::TouchEnd(pos)) if self.area.contains(pos) => {
|
||||||
self.display_style = DisplayStyle::Dots;
|
self.display_style = DisplayStyle::Hidden;
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
@ -435,15 +427,15 @@ impl Component for Input {
|
|||||||
// Jiggle when overflowed.
|
// Jiggle when overflowed.
|
||||||
if pp_len > pp_visible_len
|
if pp_len > pp_visible_len
|
||||||
&& pp_len % 2 == 0
|
&& pp_len % 2 == 0
|
||||||
&& !matches!(self.display_style, DisplayStyle::Chars)
|
&& !matches!(self.display_style, DisplayStyle::Shown)
|
||||||
{
|
{
|
||||||
cursor.x += Self::TWITCH;
|
cursor.x += Self::TWITCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
let (visible_dots, visible_chars) = match self.display_style {
|
let (visible_dots, visible_chars) = match self.display_style {
|
||||||
DisplayStyle::Dots => (pp_visible_len, 0),
|
DisplayStyle::Hidden => (pp_visible_len, 0),
|
||||||
DisplayStyle::Chars => (0, pp_visible_len),
|
DisplayStyle::Shown => (0, pp_visible_len),
|
||||||
DisplayStyle::LastChar => (pp_visible_len - 1, 1),
|
DisplayStyle::LastOnly => (pp_visible_len - 1, 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Render dots if applicable
|
// Render dots if applicable
|
||||||
@ -479,13 +471,7 @@ impl Component for Input {
|
|||||||
.render(target);
|
.render(target);
|
||||||
// Paint the pending marker.
|
// Paint the pending marker.
|
||||||
if self.multi_tap.pending_key().is_some() {
|
if self.multi_tap.pending_key().is_some() {
|
||||||
render_pending_marker(
|
render_pending_marker(target, cursor, chars, style.text_font, style.text_color);
|
||||||
target,
|
|
||||||
cursor,
|
|
||||||
chars,
|
|
||||||
style.text_font,
|
|
||||||
style.text_color,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ use crate::{
|
|||||||
Button, ButtonContent,
|
Button, ButtonContent,
|
||||||
ButtonMsg::{self, Clicked},
|
ButtonMsg::{self, Clicked},
|
||||||
},
|
},
|
||||||
|
keyboard::common::DisplayStyle,
|
||||||
theme,
|
theme,
|
||||||
},
|
},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
@ -218,7 +219,7 @@ impl Component for PinKeyboard<'_> {
|
|||||||
// Timeout for showing the last digit.
|
// Timeout for showing the last digit.
|
||||||
Event::Timer(_) if self.timeout_timer.expire(event) => {
|
Event::Timer(_) if self.timeout_timer.expire(event) => {
|
||||||
self.textbox
|
self.textbox
|
||||||
.mutate(ctx, |_ctx, t| t.set_display_style(DisplayStyle::Dots));
|
.mutate(ctx, |_ctx, t| t.set_display_style(DisplayStyle::Hidden));
|
||||||
self.textbox.request_complete_repaint(ctx);
|
self.textbox.request_complete_repaint(ctx);
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
@ -255,7 +256,7 @@ impl Component for PinKeyboard<'_> {
|
|||||||
self.timeout_timer
|
self.timeout_timer
|
||||||
.start(ctx, Duration::from_secs(LAST_DIGIT_TIMEOUT_S));
|
.start(ctx, Duration::from_secs(LAST_DIGIT_TIMEOUT_S));
|
||||||
self.textbox
|
self.textbox
|
||||||
.mutate(ctx, |_ctx, t| t.set_display_style(DisplayStyle::LastDigit));
|
.mutate(ctx, |_ctx, t| t.set_display_style(DisplayStyle::LastOnly));
|
||||||
self.textbox.request_complete_repaint(ctx);
|
self.textbox.request_complete_repaint(ctx);
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
return None;
|
return None;
|
||||||
@ -294,14 +295,6 @@ struct PinDots {
|
|||||||
display_style: DisplayStyle,
|
display_style: DisplayStyle,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
|
||||||
#[cfg_attr(feature = "ui_debug", derive(ufmt::derive::uDebug))]
|
|
||||||
enum DisplayStyle {
|
|
||||||
Dots,
|
|
||||||
Digits,
|
|
||||||
LastDigit,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PinDots {
|
impl PinDots {
|
||||||
const DOT: i16 = 6;
|
const DOT: i16 = 6;
|
||||||
const PADDING: i16 = 6;
|
const PADDING: i16 = 6;
|
||||||
@ -315,7 +308,7 @@ impl PinDots {
|
|||||||
pad: Pad::with_background(style.background_color),
|
pad: Pad::with_background(style.background_color),
|
||||||
style,
|
style,
|
||||||
digits,
|
digits,
|
||||||
display_style: DisplayStyle::Dots,
|
display_style: DisplayStyle::Hidden,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,14 +443,15 @@ impl Component for PinDots {
|
|||||||
match event {
|
match event {
|
||||||
Event::Touch(TouchEvent::TouchStart(pos)) => {
|
Event::Touch(TouchEvent::TouchStart(pos)) => {
|
||||||
if self.area.contains(pos) {
|
if self.area.contains(pos) {
|
||||||
self.display_style = DisplayStyle::Digits;
|
self.display_style = DisplayStyle::Shown;
|
||||||
self.pad.clear();
|
self.pad.clear();
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
};
|
};
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
Event::Touch(TouchEvent::TouchEnd(_)) => {
|
Event::Touch(TouchEvent::TouchEnd(_)) => {
|
||||||
if mem::replace(&mut self.display_style, DisplayStyle::Dots) == DisplayStyle::Digits
|
if mem::replace(&mut self.display_style, DisplayStyle::Hidden)
|
||||||
|
== DisplayStyle::Shown
|
||||||
{
|
{
|
||||||
self.pad.clear();
|
self.pad.clear();
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
@ -473,9 +467,9 @@ impl Component for PinDots {
|
|||||||
self.pad.render(target);
|
self.pad.render(target);
|
||||||
|
|
||||||
match self.display_style {
|
match self.display_style {
|
||||||
DisplayStyle::Digits => self.render_digits(dot_area, target),
|
DisplayStyle::Shown => self.render_digits(dot_area, target),
|
||||||
DisplayStyle::Dots => self.render_dots(false, dot_area, target),
|
DisplayStyle::Hidden => self.render_dots(false, dot_area, target),
|
||||||
DisplayStyle::LastDigit => self.render_dots(true, dot_area, target),
|
DisplayStyle::LastOnly => self.render_dots(true, dot_area, target),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user