input: Fix Input to vertical center the mask chars. (#590)

Close #467

Windows:

<img width="397" alt="image"
src="https://github.com/user-attachments/assets/0a185b42-1432-404a-b889-da1143706035"
/>

macOS:

<img width="510" alt="image"
src="https://github.com/user-attachments/assets/ed186552-862b-404e-96dc-b0f3a0b552d6"
/>
This commit is contained in:
Jason Lee 2025-01-30 10:54:02 +08:00 committed by GitHub
parent 43f529c6d2
commit 7539e6d44c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -504,6 +504,14 @@ impl Element for TextElement {
let origin = bounds.origin;
let mut offset_y = px(0.);
if self.input.read(cx).masked {
// Move down offset for vertical centering the *****
if cfg!(target_os = "macos") {
offset_y = px(3.);
} else {
offset_y = px(2.5);
}
}
for line in prepaint.lines.iter() {
let p = point(origin.x, origin.y + offset_y);
_ = line.paint(p, line_height, window, cx);