RFR: JDK-8298060: Fix precision bug in gesture recognizer classes

Andy Goryachev angorya at openjdk.org
Tue Dec 13 16:43:11 UTC 2022


On Tue, 13 Dec 2022 08:41:55 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> But is it correct? The previous code computed a deltaTime in seconds as `((currentNanos - startNanos) / 1e9)`, and then divided the `scrollMagnitude` by that. I think that the equivalent to the old code is:
>> 
>> 
>>     scrollMagnitude / (nanosPassed * NANOS_TO_SECONDS)
>
> It turns out it is not correct, the parenthesis are indeed required, not sure how I could have missed it. I'm going to see if I can add a test to this as they're missing to ensure it does the same before/after (aside from precision).

could we create a new method, like 'nanosToSeconds'?

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

PR: https://git.openjdk.org/jfx/pull/966


More information about the openjfx-dev mailing list