Closed
Description
Writing a controller for the slider it can be positioned where .999999999999 or .0000000001 appears.
Did a work around to call a function that does round.
void _setValue(val)
{
num valNumber = num.parse(val.toString());
valNumber = valNumber.round();
_valController.text = valNumber.toString();
}
One fix should be to add universal round. (not tested)
number universalRound (num number){
numDecimals = (number - number.toInt()).toString.length().clamp(0,10);
divisor = 10 ^ numDecimals;
// multiply by number of decimals add .5 then round then divide by the number of decimals and throw away the remainder.
number = (((number * divisor) + .5).round()) ~/ divisor) ;
return number;
Something like that ...
Metadata
Metadata
Assignees
Labels
No labels