mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-24 18:18:17 -06:00
ui: centre text and hint vertically in search/text fields
The TextEdit inside widgets::field took its natural height at the top of the field, so vertical_align(Center) had no room to act and the placeholder sat ~2pt above the magnifier (Timeline, Project, Effects & Presets, Home). (cherry picked from commit 6806eb4f7c955e87c6f2a5b01a9d80d43dd6ac58) (cherry picked from commit af85d220bc337d5a3c6fa94b6fa315b0d3b0c09b) (cherry picked from commit 685b7f2057839da1af9607dc0c93020f062a0946)
This commit is contained in:
@@ -301,6 +301,9 @@ fn field(ui: &mut Ui, rect: Rect, text: &mut String, hint: &str, t: &Tokens, sea
|
||||
// As tall as the field, so the text and the hint sit on its middle (they sat high, #581).
|
||||
.min_size(inner.size())
|
||||
.font(Tokens::ui(12.0))
|
||||
// Fill the field's height so the text and hint centre on the magnifier instead of
|
||||
// hugging the top edge (`vertical_align` only acts within `min_size`).
|
||||
.min_size(inner.size())
|
||||
.vertical_align(egui::Align::Center),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user