diff options
| author | 2022-04-27 08:56:43 -0700 | |
|---|---|---|
| committer | 2022-04-27 08:56:43 -0700 | |
| commit | bc8b4bb1828a8bd4fa95b585d0655adec8f85f9d (patch) | |
| tree | a8c7c571d5151ce9ce00f8a76d7df59437a924da | |
| parent | 4329f0480bec803346e7e5b8c02cc17f62b6ab35 (diff) | |
| download | iced-bc8b4bb1828a8bd4fa95b585d0655adec8f85f9d.tar.gz iced-bc8b4bb1828a8bd4fa95b585d0655adec8f85f9d.tar.bz2 iced-bc8b4bb1828a8bd4fa95b585d0655adec8f85f9d.zip  | |
Manually center top aligned text
| -rw-r--r-- | native/src/widget/pick_list.rs | 6 | 
1 files changed, 4 insertions, 2 deletions
diff --git a/native/src/widget/pick_list.rs b/native/src/widget/pick_list.rs index 5ed07863..2e61e036 100644 --- a/native/src/widget/pick_list.rs +++ b/native/src/widget/pick_list.rs @@ -402,16 +402,18 @@ pub fn draw<T, Renderer>(      if let Some(label) =          label.as_ref().map(String::as_str).or_else(|| placeholder)      { +        let text_size = f32::from(text_size.unwrap_or(renderer.default_size())); +          renderer.fill_text(Text {              content: label, -            size: f32::from(text_size.unwrap_or(renderer.default_size())), +            size: text_size,              font: font.clone(),              color: is_selected                  .then(|| style.text_color)                  .unwrap_or(style.placeholder_color),              bounds: Rectangle {                  x: bounds.x + f32::from(padding.left), -                y: bounds.center_y(), +                y: bounds.center_y() - text_size / 2.0,                  ..bounds              },              horizontal_alignment: alignment::Horizontal::Left,  | 
