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

Andy Goryachev angorya at openjdk.org
Mon May 6 16:40:59 UTC 2024


On Mon, 6 May 2024 08:49:27 GMT, Florian Kirmaier <fkirmaier at openjdk.org> wrote:

>> As seen in the unit test of the PR, when we click on the area above/below the scrollbar the position jumps - but the jump is now not always consistent.
>> In the current version on the last cell - the UI always jumps to the top. In the other cases, the assumed default cell height is used.
>> 
>> With this PR, always the default cell height is used, to determine how much is scrolled.
>> This makes the behavior more consistent.
>> 
>> Especially from the unit-test, it's clear that with this PR the behavior is much more consistent.
>> 
>> This is also related to the following PR: https://github.com/openjdk/jfx/pull/1194
>
> 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 1804:

> 1802: 
> 1803:     /**
> 1804:      * The amount of pixels by which to adjust the position when the the scroll bar track is clicked.

should it be the height of the viewport, so to speak?

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?)

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

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


More information about the openjfx-dev mailing list