-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Smooth Scrolling improved #683
base: main
Are you sure you want to change the base?
Conversation
Here is my updated test case: Among others, it allows to change the default scroll modes to see how the smooth scrolling works. One important point is to make sure that blit blocking is in place for the initial |
Have compared the source code of this PR with branch Sorry, but I'm not happy with the things you're doing and have some major concerns... Global list of viewpanesIn class This is problematic because it is easy to produce memory leaks. It is hard to Using weak references could help, but actually I'm not sure whether I like to Disabling blitting mode of all viewportsIn class This actually means that nearly all application code (triggered by mouse or key This also disables blitting for scrolling via trackpad or Magic I think disabling blitting mode, when needed, for a single viewport for a But always disabling blitting mode for all shown viewports on all JTree getRowCount()Well, I think you know yourself that this is an extreme misuse of FlatLaf/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTreeUI.java Lines 361 to 394 in c791cd0
This method should simply return the number of rows, but not temporary modify What side effects this might have is unpredictable for me... But, I had an idea how tow solve the too slow keyboard scrolling for trees (and The idea was to hook into JTree ActionMap and replace actions that do some Solving blitting problemAt the moment I see 4 possible solutions to fix the blitting problem:
I'm currently trying to implement 4. because this avoids the temporary changes The problem with using a It is also possible that people already use custom |
Hi Karl, Yes, I know, I am not too happy with some of the things I had to do to make the whole thing work. But currently, this solves all the problems I identified and it is in production. I will gladly switch to a FlatLaf official version when one is ready because having to port the patched classes everytime I update FlatLaf is annoying... One feature you did not mention (or have I misread?) is the fact that programmatically changing the view should not activate smooth scrolling unless within a user-initiated event. That user event could be from a button that is outside the scroll panes, hence the global list of viewports. Is the list garanteed to be cleared? I don't know if it is possible to block or cause exceptions in the notification of the events I am capturing.
Ah! I will have to look in details at your approach then 😄
I have to investigate that test case... |
I experimented with smooth scrolling and found that the existing implementation in PR #150 had several painting artifacts and scrolling issues.
I realized that:
This PR works for me in all cases so far (tested on Windows 10, Java 17).
The test case I use (in addition to testing on our real world application): SmoothScrollingTest.zip