ui: use proper response in wide-rendered note

This was causing hitbox issues

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-12-03 17:52:52 -08:00
parent aafddf5acb
commit 229694466a

View File

@@ -451,64 +451,68 @@ impl<'a> NoteView<'a> {
// wide design // wide design
let response = if self.options().has_wide() { let response = if self.options().has_wide() {
ui.horizontal(|ui| { ui.vertical(|ui| {
if self.pfp(note_key, &profile, ui).clicked() { ui.horizontal(|ui| {
note_action = Some(NoteAction::OpenProfile(Pubkey::new(*self.note.pubkey()))); if self.pfp(note_key, &profile, ui).clicked() {
}; note_action =
Some(NoteAction::OpenProfile(Pubkey::new(*self.note.pubkey())));
};
let size = ui.available_size(); let size = ui.available_size();
ui.vertical(|ui| { ui.vertical(|ui| {
ui.add_sized([size.x, self.options().pfp_size()], |ui: &mut egui::Ui| { ui.add_sized([size.x, self.options().pfp_size()], |ui: &mut egui::Ui| {
ui.horizontal_centered(|ui| { ui.horizontal_centered(|ui| {
selected_option = NoteView::note_header( selected_option = NoteView::note_header(
ui, ui,
self.note_cache, self.note_cache,
self.note, self.note,
&profile, &profile,
self.options(), self.options(),
container_right, container_right,
) )
.context_selection; .context_selection;
}) })
.response .response
});
let note_reply = self
.note_cache
.cached_note_or_insert_mut(note_key, self.note)
.reply
.borrow(self.note.tags());
if note_reply.reply().is_some() {
ui.horizontal(|ui| {
reply_desc(ui, txn, &note_reply, self.ndb, self.img_cache);
}); });
}
let note_reply = self
.note_cache
.cached_note_or_insert_mut(note_key, self.note)
.reply
.borrow(self.note.tags());
if note_reply.reply().is_some() {
ui.horizontal(|ui| {
reply_desc(ui, txn, &note_reply, self.ndb, self.img_cache);
});
}
});
}); });
});
let mut contents = NoteContents::new( let mut contents = NoteContents::new(
self.ndb, self.ndb,
self.img_cache, self.img_cache,
self.note_cache, self.note_cache,
txn, txn,
self.note, self.note,
note_key, note_key,
self.options(), self.options(),
); );
let resp = ui.add(&mut contents);
if let Some(action) = contents.action() { ui.add(&mut contents);
note_action = Some(*action);
}
if self.options().has_actionbar() { if let Some(action) = contents.action() {
if let Some(action) = render_note_actionbar(ui, self.note.id(), note_key).inner { note_action = Some(*action);
note_action = Some(action);
} }
}
resp if self.options().has_actionbar() {
if let Some(action) = render_note_actionbar(ui, self.note.id(), note_key).inner
{
note_action = Some(action);
}
}
})
.response
} else { } else {
// main design // main design
ui.with_layout(egui::Layout::left_to_right(egui::Align::TOP), |ui| { ui.with_layout(egui::Layout::left_to_right(egui::Align::TOP), |ui| {