RFR: 8299753: Tree/TableView: Column Resizing With Fractional Scale [v4]
Andy Goryachev
angorya at openjdk.org
Thu Jul 6 16:10:07 UTC 2023
On Thu, 6 Jul 2023 00:23:09 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>> I agree with John that a layout algorithm that uses incremental calculations will always be flawed in principle. The correct approach is to store the initial configuration, and then for each configuration change, go back to the initial configuration and recompute the layout solution.
>>
>> Now, we might still accept a bugfix for a flawed algorithm. But JDK-8299753 is an enhancement, not a bugfix. I'm not sure what to make of this: it's obviously a flawed approach, and basing an enhancement on a flawed approach means that someone would have to come back to this issue in the future and solve it correctly.
>>
>> I don't think that the issue at hand is so severe that it's a forced move to integrate this interim solution.
>
>> I respectfully disagree, @mstr2 .
>>
>> This fix is not an interim solution - unlike any theoretical considerations of "flawed approach", in practice this code does work as expected with integer and fractional scales, and, given our situation, it's highly unlikely that any alternative solutions will ever be considered, especially those that would affect existing public APIs.
>
> It isn't just a theoretical issue. The proposed patch fails to keep the divider precisely at the cursor location, depending on frame rate and mouse movement speed. This is how the behavior manifests on my machine:
>
> https://github.com/openjdk/jfx/assets/43553916/79cf04be-bd18-4cfe-9c34-912978ee96ee
Thank you for the video, @mstr2
This is an intrinsic problem with the Tree/TableView - you can observe it even with the UNCONSTRAINED_RESIZE_POLICY. You both are right in that it's impossible to fix this without remembering the initial MOUSE_PRESSED position. I wonder if it's possible to fix it without making API changes.
However, fixing this is out of scope for this PR. This PR deals with correctly handling of fractional scale (within the constraints of the current resize policy API) and cursor decoupling even when moving very slowly.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1156#issuecomment-1623937662
More information about the openjfx-dev
mailing list