Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put together failing test case for egui_virtual_list #38

Closed
jb55 opened this issue Apr 29, 2024 · 6 comments
Closed

Put together failing test case for egui_virtual_list #38

jb55 opened this issue Apr 29, 2024 · 6 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jb55
Copy link
Contributor

jb55 commented Apr 29, 2024

@lucasmerlin's egui_virtual_list seems to not support adding items to the start of a list in reverse chrononological order. when you scroll up it tends to skip:

https://cdn.jb55.com/s/virtual-list-buggy.mp4

Let's put together a minimal failing test case so that we can investigate this issue.

Alternatively we can look into @mikedilger's approach in gossip.

@jb55 jb55 added the bug Something isn't working label Apr 29, 2024
@jb55 jb55 added this to the notedeck 0.1 milestone Apr 29, 2024
@lucasmerlin
Copy link

lucasmerlin commented Apr 29, 2024

This is actually a problem I also had with egui_infinite_scroll (which also supports loading items from the top when scrolling up), and there is a fix for it (although not very pretty):
You can call items_inserted_at_start when you add items at the top, and it will measure the height of the inserted items and scroll by the measured amount to prevent it from jumping around. (This was actually a pain to implement because it's not something egui's ScrollArea supports on it's own, and scrolling a certain amount was buggy at that time)

You can also look at the both_directions example in the infinite scroll crate to see it implemented. (Sorry I was confusing infinite_scroll and virtual_list, but you could look at the infinite scroll source code to see how it interacts with egui_virtual_list to add items at the top)

@jb55
Copy link
Contributor Author

jb55 commented May 12, 2024

@lucasmerlin oops I just saw this comment. thanks! I will check out that code. it sounds like that's what we need.

@jb55
Copy link
Contributor Author

jb55 commented May 16, 2024

@lucasmerlin I added the call right after I insert data into the list before render, I get this (starts at 5seconds):

https://cdn.jb55.com/s/bumpy.mp4

@jb55
Copy link
Contributor Author

jb55 commented May 16, 2024

oh I may just need to turn off scroll animations... that makes sense

@lucasmerlin
Copy link

Yeah, the scroll animations are the problem. Are you using the latest egui version? You should be able to do ScrollArea::animated to turn them off.
Related egui stuff:
emilk/egui#4309
emilk/egui#4295

@jb55
Copy link
Contributor Author

jb55 commented May 16, 2024

turning off animations fixed everything! this works great now. amazing. thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Review
Development

No branches or pull requests

2 participants