Closed pixelzoom closed 1 year ago
You could also replace the 3 occurrences of
( enabledRangeProperty.get().max - enabledRangeProperty.get().min )
with
enabledRangeProperty.get().getLength()
... and that should address this issue.
Because for example, new phet.dot.Range( -3, 0 ).getLength() => 3
.
Hmmm... Now I'm confused about why the default steps are negative. Because:
> var r = new phet.dot.Range( -3, 0 )
> r.max - r.min
3
Perhaps there's a problem elsewhere?
I am trying to see this on my side but haven't been able to. I ran acid-base-solutions with ?supportsInteractiveDescription=true
and didn't hit an assertion and I didn't see workarounds committed related to this. I tried this patch in the sun demo (setting the range of the slider from -3 to 0) and it worked OK.
It may not be from the option but using the setShiftKeyboardStep
function later? Is there a reproducible example you can point me to?
I ultimately punted on what I was trying to do in https://github.com/phetsims/acid-base-solutions/issues/167, so the case where I was experiencing this problem no longer exists. And I don't have time to invent a case to investigate. So I'm just going to close this issue. Thanks for having a look @jessegreenberg, and apologies for wasting your time.
In AccessibleValueHandler.ts:
This makes some bad assumptions about the range. If I have range [-3,0] for example (which I do in acid-base-solution), then these steps will be negative, and this assertion (and others?) will fail in AccessibleValueHandler.ts:
It might simply be a matter of putting
Math.abs
around these values. But I haven't had time to test.In the meantime, I'll explicitly set these options to workaround this.