make Widget impl ProfilePic mutably

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-04-29 16:05:58 -04:00
parent 640bf742c0
commit 7d2112b472
10 changed files with 30 additions and 21 deletions

View File

@@ -265,7 +265,7 @@ impl<'a, 'd> NoteView<'a, 'd> {
ui.put(
rect,
ProfilePic::new(self.note_context.img_cache, pic).size(size),
&mut ProfilePic::new(self.note_context.img_cache, pic).size(size),
)
.on_hover_ui_at_pointer(|ui| {
ui.set_max_width(300.0);
@@ -290,8 +290,11 @@ impl<'a, 'd> NoteView<'a, 'd> {
ui.put(
rect,
ProfilePic::new(self.note_context.img_cache, notedeck::profile::no_pfp_url())
.size(pfp_size as f32),
&mut ProfilePic::new(
self.note_context.img_cache,
notedeck::profile::no_pfp_url(),
)
.size(pfp_size as f32),
)
.interact(sense)
}

View File

@@ -11,7 +11,7 @@ pub struct ProfilePic<'cache, 'url> {
border: Option<Stroke>,
}
impl egui::Widget for ProfilePic<'_, '_> {
impl egui::Widget for &mut ProfilePic<'_, '_> {
fn ui(self, ui: &mut egui::Ui) -> egui::Response {
render_pfp(ui, self.cache, self.url, self.size, self.border)
}

View File

@@ -38,7 +38,7 @@ impl<'a, 'cache> ProfilePreview<'a, 'cache> {
ui.put(
pfp_rect,
ProfilePic::new(self.cache, get_profile_url(Some(self.profile)))
&mut ProfilePic::new(self.cache, get_profile_url(Some(self.profile)))
.size(size)
.border(ProfilePic::border_stroke(ui)),
);
@@ -90,7 +90,7 @@ impl egui::Widget for SimpleProfilePreview<'_, '_> {
fn ui(self, ui: &mut egui::Ui) -> egui::Response {
Frame::new()
.show(ui, |ui| {
ui.add(ProfilePic::new(self.cache, get_profile_url(self.profile)).size(48.0));
ui.add(&mut ProfilePic::new(self.cache, get_profile_url(self.profile)).size(48.0));
ui.vertical(|ui| {
ui.add(display_name_widget(&get_display_name(self.profile), true));
if !self.is_nsec {