emilk / egui

egui: an easy-to-use immediate mode GUI in Rust that runs on both web and native
https://www.egui.rs/
Apache License 2.0
20.61k stars 1.49k forks source link

Fix: `ScrollArea` repeatedly appears and disappears quickly issue. #4658

Open rustbasic opened 2 weeks ago

rustbasic commented 2 weeks ago

If the mouse is at a specific position above the ScrollArea (in TextEdit?), the ScrollArea repeatedly appears and disappears quickly. You can more easily find the issue if you set Full bar width to the maximum value of 32.

If there is a better way to fix this than the solution in this Pull Request, please revise it accordingly.

emilk commented 5 days ago

Please give a repro of the problem so I can test this

rustbasic commented 5 days ago

Please give a repro of the problem so I can test this

It is difficult to capture, so I will explain how to reproduce it instead.

To make it easier to reproduce the bug, Open settings_ui in egui_demo_app, go to Spacing -> Scroll Area -> Details, Select Floating, And set Full bar width to 32.

To easily reproduce the bug, open a window containing a ScrollArea and repeatedly hover your mouse pointer over the ScrollArea.


The bug could be happening when the mouse cursor is exactly on the boundary of the ScrollArea or when a specific condition is met.

This PR also has the advantage of making the ScrollArea easier to select.

emilk commented 4 days ago

I fail to reproduce any problem. Do you have a video of it?

rustbasic commented 4 days ago

I fail to reproduce any problem. Do you have a video of it?

https://github.com/rustbasic/rustbasic/blob/main/egui%20demo%20app%202024-06-25%2017-26-02.mp4 ( I am uploading this because it exceeds the 10MB limit. I can't even edit videos. )

When I go to the font book from the 2/3rd point of the video to the end, the 'Scroll Bar' keeps appearing and disappearing, but in the video, it appears to be blurry due to a save fps issue.

Regardless of the specific conditions, the same symptom appears in all Scroll Bars.

You can tell because it blinks once every few dozen times. If you want to keep blinking, you have to stop the mouse right away when it blinks, so it will keep blinking, so you have to do it hundreds of times.