button: Fix Button text to align vertical center. (#286)
<img width="1188" alt="image" src="https://github.com/user-attachments/assets/084727c3-5822-4325-9bbf-374b357b670f"> The point is add `.font_family(".SystemUIFont")` to root view.
This commit is contained in:
parent
2b134e47a1
commit
baa45173d1
2 changed files with 2 additions and 14 deletions
|
|
@ -284,6 +284,7 @@ impl Render for StoryWorkspace {
|
|||
let notifications_count = cx.notifications().len();
|
||||
|
||||
div()
|
||||
.font_family(".SystemUIFont")
|
||||
.relative()
|
||||
.size_full()
|
||||
.flex()
|
||||
|
|
|
|||
|
|
@ -314,13 +314,6 @@ impl RenderOnce for Button {
|
|||
_ => self.size,
|
||||
};
|
||||
|
||||
// Hotfix the font vertical center for macOS.
|
||||
let text_offset_top = if cfg!(target_os = "windows") {
|
||||
px(0.)
|
||||
} else {
|
||||
px(2.)
|
||||
};
|
||||
|
||||
self.base
|
||||
.id(self.id)
|
||||
.flex()
|
||||
|
|
@ -443,13 +436,7 @@ impl RenderOnce for Button {
|
|||
)
|
||||
})
|
||||
.when_some(self.label, |this, label| {
|
||||
this.child(
|
||||
div()
|
||||
.flex_none()
|
||||
.mt(text_offset_top)
|
||||
.line_height(relative(1.))
|
||||
.child(label),
|
||||
)
|
||||
this.child(div().flex_none().line_height(relative(1.)).child(label))
|
||||
})
|
||||
.children(self.children)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue