input: Fix text not in vertical center when masked text is empty. (#1753)
Closes #1724 ## Screenshot ### Before <img width="824" height="656" alt="CleanShot20251206132455" src="https://github.com/user-attachments/assets/dc917dc2-1c48-4a7a-bc24-29f09f656d95" /> ### After <img width="826" height="654" alt="CleanShot20251206132600" src="https://github.com/user-attachments/assets/3a62e7fd-1f85-4165-84bf-7a9b25f5ef3d" /> --------- Co-authored-by: Jason Lee <huacnlee@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
9b3b2802cc
commit
3ecd9c7606
2 changed files with 3 additions and 1 deletions
|
|
@ -65,6 +65,7 @@ impl InputStory {
|
||||||
let mask_input = cx.new(|cx| {
|
let mask_input = cx.new(|cx| {
|
||||||
InputState::new(window, cx)
|
InputState::new(window, cx)
|
||||||
.masked(true)
|
.masked(true)
|
||||||
|
.placeholder("Enter your password...")
|
||||||
.default_value("this-is-password-中文🚀🎉")
|
.default_value("this-is-password-中文🚀🎉")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1179,7 +1179,8 @@ impl Element for TextElement {
|
||||||
let invisible_top_padding = prepaint.last_layout.visible_top;
|
let invisible_top_padding = prepaint.last_layout.visible_top;
|
||||||
|
|
||||||
let mut mask_offset_y = px(0.);
|
let mut mask_offset_y = px(0.);
|
||||||
if self.state.read(cx).masked {
|
let state = self.state.read(cx);
|
||||||
|
if state.masked && state.text.len() > 0 {
|
||||||
// Move down offset for vertical centering the *****
|
// Move down offset for vertical centering the *****
|
||||||
if cfg!(target_os = "macos") {
|
if cfg!(target_os = "macos") {
|
||||||
mask_offset_y = px(3.);
|
mask_offset_y = px(3.);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue