RFR: 8242553: IntegerSpinner and DoubleSpinner do not wrap around values correctly in some cases
Kevin Rushforth
kcr at openjdk.org
Tue Mar 26 22:16:26 UTC 2024
On Tue, 26 Mar 2024 21:32:16 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
> > * Use modulo arithmetic to compute the value (what this PR proposed)
> > * Don't process the increment at all (i.e., treat it as an out-of-range request and do nothing)
>
> 3. fall back to amountToStepBy=1
>
> try this: integer spinner, min=0. max=100, step=137. initial value 50 there is the sequence when repeatedly pressing arrow down button: 14, 79, 43, 7, 72, 36, 0, ...
>
> makes no sense.
But if that's what the app says to do, and given that it's a well-defined operation (albeit not very useful in this example), there should be a good reason to ignore it. I'm not convinced that there is, but if there is, option 3 isn't it.
> falling back to step=1:
>
> 49, 48, 47, 46, ...
That's at least as arbitrary as clamping to the max value (the status quo). Clamping the result to the max says, in effect, "let's ignore the `wrap` flag" when we conclude that wrapping beyond a certain limit doesn't make sense. Setting the increment to 1 says, in effect, "let's ignore the `step` value" when we conclude that wrapping beyond a certain limit doesn't make sense. If we really are determined to not honor the step value / wrap flag when we conclude that wrapping beyond a certain limit doesn't make sense, then we should treat it as an app error and do nothing.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1431#issuecomment-2021560800
More information about the openjfx-dev
mailing list