RFR: 8323511: Scrollbar Click jumps inconsistent amount of pixels [v3]

eduardsdv duke at openjdk.org
Mon May 6 17:23:59 UTC 2024


On Mon, 6 May 2024 16:35:14 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Florian Kirmaier has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   JDK-8323511: Fix scrolling when clicking the scrollbar track when only one cell is visible
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/VirtualFlow.java line 1810:
> 
>> 1808:     public double getBlockIncrement() {
>> 1809:         // For reasons of backward compatibility, we use the cell length of the empty cell (cell index -1)
>> 1810:         return getCellLength(-1);
> 
> How would that work when cell heights are different for each cell?
> 
> What if the cell height is much larger than the viewport height (as in, 10 times larger?)

I don't like that either, but as I said I didn't want to change it because of backwards compatibility. 

----
I would like to make it configurable or even make the complete scrolling behavior interchangeable.
Because, the actual scrolling behavior is still not consistent. 

If multiple cells are visible, the cells are currently aligned (when clicking on the scrollbar) so that they are either exactly at the top or exactly at the bottom. If only one cell is visible, the scrolling behavior changes to the applying of pixel delta.

For example, if you have two large cells and a small ViewPort so that only one cell is visible.
1) If you click on the thumb below the scroll bar, the ListView is scrolled by a pixel delta so that two cells can become visible. 
2) If you click below scroll thumb again, the ListView scrolls so that the second cell appears at the top. 
3) If you click above the scroll thumb, the ListView scrolls by pixel delta, as the second cell is also larger than the viewport. 

Now the ListView is in a different state than before the click (2).

These two behaviors are each useful for their own situation and should not be mixed.
1) Align the cell at the top or bottom if you have cells of the same size that are smaller than the viewport.
2) Scroll by pixel delta if you have cells of different sizes or if the cells are larger than the viewport.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1326#discussion_r1591327052


More information about the openjfx-dev mailing list