Precision lost when manually typing 5+ decimals or starting with a minus
Closed this issue · 5 comments
Hi,
it seems the precision is not respected when typing manually into the slider ( it works when selected with mouse-wheel). I can change the precision inside the saved settings thought. But I would expect that the precision should automatically increase when I type longer number?
java_wBIMjZzlRE.mp4
This should automatically set the precision but maybe the problem here is that you're trying to use more decimals than we can represent - I bet it works if you just use 4 decimals.
I'll take a look at this edge case when you input more than 4 decimals, it should set the highest available precision.
This is my definition for the slider:
PVector bottomLeft = new PVector( gui.slider("area coords/bottomLeft/lat", 32.888635), gui.slider("area coords/bottomLeft/long", -96.595225) );
Note that in both cases I am setting precision to 6 decimal spaces but it is not respected in case of the negative number. I need those 6 decimal places as it is a difference between precision in kilometers and few centimeters in case of GPS coordinates - 4 places is sadly just not enough. I might get around this by using string input I guess. But I bet there will be more people who would like to have more precise sliders than 4 decimals.
1.json
This is my settings when saved doing no edits - with given definition of the slider (at the end of the settings). You can see that internally the value is preserved but strangely in GUI the negative number shows as Int. But the positive values is showed with decimal places.
Excerpt:
"children": [
{
"valueFloat": 32.889584,
"currentPrecisionIndex": 2,
"valueFloatPrecision": 0.01,
"className": "SliderNode",
"path": "area coords/bottomRight/lat",
"type": "VALUE"
},
{
"valueFloat": -96.59018,
"currentPrecisionIndex": 4,
"valueFloatPrecision": 1.0,
"className": "SliderNode",
"path": "area coords/bottomRight/long",
"type": "VALUE"
}
It appears that the minus breaks precision auto-detection due to it not being expected by the
FRACTIONAL_FLOAT_REGEX inside SliderNode.java, that should be an easy fix.
this will be fixed soon in v1.8.3