Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8315748 | jfx17.0.9 | Jose Pereda | P3 | Resolved | Fixed | b03 |
When the cells in a control that is using VirtualFlow are resized, the total size of the cells is changed. This reflects in the scrollbar thumb size and position.
If we want the position of the thumb constant, this implies the coordinates of the cells need to change. This can lead to annoying side effects, where a cell is no longer inside the visible viewport.
The current VirtualFlow implementation already makes sure that during the layoutChildren() phase no changes in the positioning of the cells can happen due to cell resize or estimate changes in general.
However, when applying a scroll action immediately after a cell resize, the positioning calculations are based on the new values (new cell dimensions and estimates, that is), which can be very different from the old values. Therefore, a cell that is e.g. 40 pixels inside the viewport before a resize happens can be outside the viewport, even if we only asked to scroll 20 pixels up.
An approach to fix this is to allow the positioning calculations to fix 2 values before and after the calculations:
1. the current index (the index of the first cell that is at least partially visible) should be the same before/after
2. the current offset (the position of this first cell relative to the offset) should be the same before/after
A consequence of this suggested approach is that the scrollbar thumb might show a jump, as by fixing the 2 parameters above, the relative position might change.
If we want the position of the thumb constant, this implies the coordinates of the cells need to change. This can lead to annoying side effects, where a cell is no longer inside the visible viewport.
The current VirtualFlow implementation already makes sure that during the layoutChildren() phase no changes in the positioning of the cells can happen due to cell resize or estimate changes in general.
However, when applying a scroll action immediately after a cell resize, the positioning calculations are based on the new values (new cell dimensions and estimates, that is), which can be very different from the old values. Therefore, a cell that is e.g. 40 pixels inside the viewport before a resize happens can be outside the viewport, even if we only asked to scroll 20 pixels up.
An approach to fix this is to allow the positioning calculations to fix 2 values before and after the calculations:
1. the current index (the index of the first cell that is at least partially visible) should be the same before/after
2. the current offset (the position of this first cell relative to the offset) should be the same before/after
A consequence of this suggested approach is that the scrollbar thumb might show a jump, as by fixing the 2 parameters above, the relative position might change.