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:
parent
43f529c6d2
commit
7539e6d44c
1 changed files with 8 additions and 0 deletions
|
|
@ -504,6 +504,14 @@ impl Element for TextElement {
|
||||||
let origin = bounds.origin;
|
let origin = bounds.origin;
|
||||||
|
|
||||||
let mut offset_y = px(0.);
|
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() {
|
for line in prepaint.lines.iter() {
|
||||||
let p = point(origin.x, origin.y + offset_y);
|
let p = point(origin.x, origin.y + offset_y);
|
||||||
_ = line.paint(p, line_height, window, cx);
|
_ = line.paint(p, line_height, window, cx);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue