diff --git a/src/ui/anim.rs b/src/ui/anim.rs index 142fe15..039241c 100644 --- a/src/ui/anim.rs +++ b/src/ui/anim.rs @@ -4,16 +4,16 @@ pub fn hover_expand( size: f32, expand_size: f32, anim_speed: f32, -) -> (egui::Rect, f32) { +) -> (egui::Rect, f32, egui::Response) { // Allocate space for the profile picture with a fixed size let default_size = size + expand_size; let (rect, response) = - ui.allocate_exact_size(egui::vec2(default_size, default_size), egui::Sense::hover()); + ui.allocate_exact_size(egui::vec2(default_size, default_size), egui::Sense::click()); let val = ui .ctx() .animate_bool_with_time(id, response.hovered(), anim_speed); let size = size + val * expand_size; - (rect, size) + (rect, size, response) } diff --git a/src/ui/note/mod.rs b/src/ui/note/mod.rs index d08070f..c6fac2a 100644 --- a/src/ui/note/mod.rs +++ b/src/ui/note/mod.rs @@ -207,7 +207,7 @@ impl<'a> Note<'a> { if self.app.is_mobile() { ui.add(ui::ProfilePic::new(&mut self.app.img_cache, pic)); } else { - let (rect, size) = ui::anim::hover_expand( + let (rect, size, _resp) = ui::anim::hover_expand( ui, egui::Id::new((profile_key, note_key)), pfp_size, @@ -295,7 +295,7 @@ impl<'a> Note<'a> { )); if self.options().has_actionbar() { - note_action = render_note_actionbar(ui).inner; + note_action = render_note_actionbar(ui, note_key).inner; } }); }) @@ -313,7 +313,10 @@ pub enum BarAction { Reply, } -fn render_note_actionbar(ui: &mut egui::Ui) -> egui::InnerResponse> { +fn render_note_actionbar( + ui: &mut egui::Ui, + note_key: NoteKey, +) -> egui::InnerResponse> { ui.horizontal(|ui| { let img_data = if ui.style().visuals.dark_mode { egui::include_image!("../../../assets/icons/reply.png") @@ -322,16 +325,25 @@ fn render_note_actionbar(ui: &mut egui::Ui) -> egui::InnerResponse