Skip to content

Commit

Permalink
use slightly better carousel id
Browse files Browse the repository at this point in the history
still need to include timeline...

Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Jul 4, 2024
1 parent 86d4d21 commit b1cefb6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ui/note/contents.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::ui::note::NoteOptions;
use crate::{colors, ui, Damus};
use egui::scroll_area::ScrollBarVisibility;
use egui::{Color32, Hyperlink, Image, RichText};
use nostrdb::{BlockType, Mention, Note, NoteKey, Transaction};
use tracing::warn;
Expand Down Expand Up @@ -187,22 +186,23 @@ fn render_note_contents(

if !images.is_empty() && !damus.textmode {
ui.add_space(2.0);
image_carousel(ui, images);
let carousel_id = egui::Id::new(("carousel", note.key().expect("expected tx note")));
image_carousel(ui, images, carousel_id);
ui.add_space(2.0);
}

resp
}

fn image_carousel(ui: &mut egui::Ui, images: Vec<String>) {
fn image_carousel(ui: &mut egui::Ui, images: Vec<String>, carousel_id: egui::Id) {
// let's make sure everything is within our area

let height = 360.0;
let width = ui.available_size().x;

ui.add_sized([width, height], |ui: &mut egui::Ui| {
egui::ScrollArea::horizontal()
.scroll_bar_visibility(ScrollBarVisibility::AlwaysVisible)
.id_source(carousel_id)
.show(ui, |ui| {
ui.horizontal(|ui| {
for image in images {
Expand Down

0 comments on commit b1cefb6

Please sign in to comment.