From db1642bc31fcb27e49abae6044c0d0d413fc0ad5 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Thu, 13 Jun 2024 09:10:31 -0700 Subject: [PATCH] remove useless struct we can just use tuples for compound ids Signed-off-by: William Casarin --- src/timeline.rs | 2 +- src/ui/note/mod.rs | 21 ++------------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/timeline.rs b/src/timeline.rs index d072ff1..cb04185 100644 --- a/src/timeline.rs +++ b/src/timeline.rs @@ -271,7 +271,7 @@ pub fn timeline_view(ui: &mut egui::Ui, app: &mut Damus, timeline: usize) { // need this for some reason?? ui.add_space(3.0); - let scroll_id = ui.id().with(app.timelines[timeline].selected_view); + let scroll_id = egui::Id::new(("tlscroll", app.timelines[timeline].selected_view, timeline)); egui::ScrollArea::vertical() .id_source(scroll_id) .animated(false) diff --git a/src/ui/note/mod.rs b/src/ui/note/mod.rs index a13a465..d08070f 100644 --- a/src/ui/note/mod.rs +++ b/src/ui/note/mod.rs @@ -7,7 +7,6 @@ pub use options::NoteOptions; use crate::{colors, notecache::CachedNote, ui, ui::View, Damus}; use egui::{Label, RichText, Sense}; use nostrdb::{NoteKey, Transaction}; -use std::hash::{Hash, Hasher}; pub struct Note<'a> { app: &'a mut Damus, @@ -26,20 +25,6 @@ impl<'a> View for Note<'a> { } } -#[derive(Eq, PartialEq, Debug, Clone, Copy)] -struct ProfileAnimId { - profile_key: u64, - note_key: u64, -} - -impl Hash for ProfileAnimId { - fn hash(&self, state: &mut H) { - state.write_u8(0x12); - self.profile_key.hash(state); - self.note_key.hash(state); - } -} - fn reply_desc( ui: &mut egui::Ui, txn: &Transaction, @@ -224,10 +209,7 @@ impl<'a> Note<'a> { } else { let (rect, size) = ui::anim::hover_expand( ui, - egui::Id::new(ProfileAnimId { - profile_key, - note_key, - }), + egui::Id::new((profile_key, note_key)), pfp_size, expand_size, anim_speed, @@ -345,6 +327,7 @@ fn render_note_actionbar(ui: &mut egui::Ui) -> egui::InnerResponse