Skip to content

Commit

Permalink
Fix cursors not being reset
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmerlin committed Nov 8, 2023
1 parent d38f677 commit dd739cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/egui_infinite_scroll/examples/infinite_scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ pub fn main() -> eframe::Result<()> {
move |ctx, _frame| {
CentralPanel::default().show(ctx, |ui| {
ScrollArea::vertical().show(ui, |ui| {
if ui.button("Reset").clicked() {
infinite_scroll.reset();
};

infinite_scroll.ui(ui, 10, |ui, _index, item| {
ui.label(format!("Item {}", item));
});
Expand Down
2 changes: 2 additions & 0 deletions crates/egui_infinite_scroll/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ impl<T: Debug + Send + Sync + 'static, Cursor: Clone + Debug + Send + 'static>
self.items.clear();
self.top_loading_state = LoadingState::Idle;
self.bottom_loading_state = LoadingState::Idle;
self.start_cursor = None;
self.end_cursor = None;

// Create new inboxes in case there is a request in progress
self.top_inbox = UiInbox::new();
Expand Down

0 comments on commit dd739cd

Please sign in to comment.