@@ -50,8 +50,10 @@ impl BlinkCursor {
|
||||
|
||||
// Schedule the next blink
|
||||
let epoch = self.next_epoch();
|
||||
|
||||
cx.spawn(async move |this, cx| {
|
||||
Timer::after(INTERVAL).await;
|
||||
|
||||
if let Some(this) = this.upgrade() {
|
||||
this.update(cx, |this, cx| this.blink(epoch, cx)).ok();
|
||||
}
|
||||
@@ -71,6 +73,7 @@ impl BlinkCursor {
|
||||
|
||||
// delay 500ms to start the blinking
|
||||
let epoch = self.next_epoch();
|
||||
|
||||
cx.spawn(async move |this, cx| {
|
||||
Timer::after(PAUSE_DELAY).await;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ use super::TextInput;
|
||||
|
||||
const RIGHT_MARGIN: Pixels = px(5.);
|
||||
const BOTTOM_MARGIN: Pixels = px(20.);
|
||||
const CURSOR_THICKNESS: Pixels = px(2.);
|
||||
|
||||
pub(super) struct TextElement {
|
||||
input: Entity<TextInput>,
|
||||
@@ -140,7 +141,7 @@ impl TextElement {
|
||||
if input.show_cursor(window, cx) {
|
||||
// cursor blink
|
||||
let cursor_height =
|
||||
window.text_style().font_size.to_pixels(window.rem_size()) + px(2.);
|
||||
window.text_style().font_size.to_pixels(window.rem_size()) + px(4.);
|
||||
|
||||
cursor = Some(fill(
|
||||
Bounds::new(
|
||||
@@ -148,9 +149,9 @@ impl TextElement {
|
||||
bounds.left() + cursor_pos.x,
|
||||
bounds.top() + cursor_pos.y + ((line_height - cursor_height) / 2.),
|
||||
),
|
||||
size(px(1.), cursor_height),
|
||||
size(CURSOR_THICKNESS, cursor_height),
|
||||
),
|
||||
cx.theme().element_active,
|
||||
cx.theme().cursor,
|
||||
))
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user