Skip to content

Commit

Permalink
Fix slider value calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Raicuparta committed Aug 3, 2020
1 parent 7ce00e8 commit ae00f6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions OWML.ModHelper.Menus/ModSliderInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ private void UpdateValueText()

private float ToRealNumber(float fakeNumber)
{
return fakeNumber * (Max - Min) / 10;
return 0.1f * (fakeNumber * (Max - Min)) + Min;
}

private float ToFakeNumber(float realNumber)
{
return realNumber * 10 / (Max - Min);
return 10 * (realNumber - Min) / (Max - Min);
}
}
}
12 changes: 12 additions & 0 deletions OWML.SampleMods/OWML.LoadCustomAssets/default-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
"min": 0,
"max": 20
},
"negativeMin": {
"type": "slider",
"value": -2,
"min": -10,
"max": 20
},
"negativeMax": {
"type": "slider",
"value": -2,
"min": -50,
"max": -20
},
"decimals": {
"type": "slider",
"value": 10.54545,
Expand Down

0 comments on commit ae00f6b

Please sign in to comment.