Skip to content

Commit

Permalink
input: Fix Input to vertical center the mask chars. (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee authored Jan 30, 2025
1 parent 43f529c commit 7539e6d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/ui/src/input/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7539e6d

Please sign in to comment.