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

John Hendrikx jhendrikx at openjdk.org
Mon Dec 12 22:20:25 UTC 2022


On Mon, 12 Dec 2022 22:08:57 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> your change is equivalent to 
>> 
>> (scrollMagnitude * NANOS_TO_SECONDS) / nanosPassed
>> 
>> is that correct?
>
> That would be equivalent yes.
> 
> Perhaps it is because `timePassed` was a `double` before measured in seconds while I'm now doing the calculation with nano seconds?

Okay I see what you're getting at, your first suggestion would not be correct, it's supposed to be what you suggest in the 2nd one.  So what I want is:

     (scrollMagnitude / nanosPassed) * NANOS_TO_SECONDS

or:

     (scrollMagnitude * NANOS_TO_SECONDS) / nanosPassed

...but that's the same as what I wrote.

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

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


More information about the openjfx-dev mailing list