windows: Fix button and checkbox line-height again. (#244)

<img width="1202"
src="https://github.com/user-attachments/assets/6741041a-f449-4600-bec1-751841dcec88">
This commit is contained in:
Jason Lee 2024-09-13 22:55:59 +08:00 committed by GitHub
parent d8ace3c683
commit 55585f9699
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 12 deletions

View file

@ -422,14 +422,7 @@ impl RenderOnce for Button {
this.child(Indicator::new().with_size(self.size))
})
.when_some(self.label, |this, label| {
this.child(
div()
// FIXME: Move down 3px to vertically center the text
.mt(px(2.))
.flex_none()
.line_height(relative(1.))
.child(label),
)
this.child(div().flex_none().line_height(relative(1.)).child(label))
})
.children(self.children)
})

View file

@ -1,5 +1,5 @@
use gpui::{
div, prelude::FluentBuilder as _, rems, svg, ElementId, InteractiveElement, IntoElement,
div, prelude::FluentBuilder as _, relative, svg, ElementId, InteractiveElement, IntoElement,
ParentElement, RenderOnce, SharedString, StatefulInteractiveElement as _, Styled as _,
WindowContext,
};
@ -117,7 +117,7 @@ impl RenderOnce for Checkbox {
div()
.w_full()
.overflow_hidden()
.line_height(rems(1.2))
.line_height(relative(1.))
.child(label),
)
} else {

View file

@ -1,5 +1,5 @@
use gpui::{
div, prelude::FluentBuilder, rems, svg, CursorStyle, ElementId, InteractiveElement,
div, prelude::FluentBuilder, relative, svg, CursorStyle, ElementId, InteractiveElement,
IntoElement, ParentElement, RenderOnce, SharedString, StatefulInteractiveElement, Styled,
WindowContext,
};
@ -91,7 +91,7 @@ impl RenderOnce for Radio {
div()
.size_full()
.overflow_hidden()
.line_height(rems(1.2))
.line_height(relative(1.))
.child(label),
)
})