egui
egui copied to clipboard
Strange scrolling behavior - jitter up and down
Discussed in https://github.com/emilk/egui/discussions/1784
Originally posted by John-Nagle June 30, 2022 I'm getting some strange scrolling behavior. Code is in Github here. You can build it and run it. This is a mockup of a user interface I'm using to make sure that Egui, Rend3, Winit, and WGPU all play well together cross-platform before I hook in the heavy machinery of the metaverse client.
So the first screen is a big scroll area of big buttons, one for each metaverse grid.
The code for this follows the instructions here.
It looks fine, but not all the menu items fit, so scrolling is needed. The trouble is, if I scroll down far enough to fully expose the bottom menu item, the display starts flickering, alternating between two scroll states.
So I put a println! in the draw function to see what the row range was doing.
println!("Rows: {:?} of {}, row height {}", row_range, self.grids.len(), row_height); // ***TEMP***
Output is:
Rows: 0..3 of 3, row height 18
Rows: 2..3 of 3, row height 18
Rows: 0..3 of 3, row height 18
Rows: 2..3 of 3, row height 18
Rows: 0..3 of 3, row height 18
Rows: 2..3 of 3, row height 18
Rows: 0..3 of 3, row height 18
Rows: 2..3 of 3, row height 18
Rows: 0..3 of 3, row height 18
Rows: 2..3 of 3, row height 18
Uh oh. So successive calls alternate between starting with row 0 and row 2, and the display looks like what you'd expect with that happening. I'm not doing anything different between calls; it's just a refresh loop.
Also, I noticed that if I have a large number of rows, the row range start may change, but the row range end is always the last item, so it's drawing too much.
Am I doing something wrong, or what?
(Egui 0.17.0, for compatibility with Rend3)
Am I doing something wrong, or what?
Maybe? I really don't have enough information to go on. So row_range
changes, but why? Dig deeper! Use a debugger!