commit f748b8b34a7331971cb3a986b0e8610c10918d5b
parent 4967f64bb62f2d055005cc3b44872e38d5f2931f
Author: William Casarin <jb55@jb55.com>
Date: Tue, 17 Dec 2024 14:38:13 -0800
profile: fix avatar alignment in profile previews
Changelog-Fixed: Fix avatar alignment in profile previews
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/crates/notedeck_columns/src/ui/profile/preview.rs b/crates/notedeck_columns/src/ui/profile/preview.rs
@@ -64,8 +64,18 @@ impl<'a, 'cache> ProfilePreview<'a, 'cache> {
}
fn body(self, ui: &mut egui::Ui) {
- crate::ui::padding(12.0, ui, |ui| {
- ui.add(ProfilePic::new(self.cache, get_profile_url(Some(self.profile))).size(80.0));
+ let padding = 12.0;
+ crate::ui::padding(padding, ui, |ui| {
+ let mut pfp_rect = ui.available_rect_before_wrap();
+ let size = 80.0;
+ pfp_rect.set_width(size);
+ pfp_rect.set_height(size);
+ let pfp_rect = pfp_rect.translate(egui::vec2(0.0, -(padding + 2.0 + (size / 2.0))));
+
+ ui.put(
+ pfp_rect,
+ ProfilePic::new(self.cache, get_profile_url(Some(self.profile))).size(size),
+ );
ui.add(display_name_widget(
get_display_name(Some(self.profile)),
false,