@@ -976,11 +976,12 @@ local function AddCheck(parent, labelKey, tipKey, settingKey, x, y)
976976 return check
977977end
978978
979- -- Always 2 decimals ("12,00", "1,50", "1,25"), with the decimal comma in every panel language
980- -- except English.
981- local function FormatNumber (value )
982- local text = string.format (" %.2f" , value )
983- if text == " -0.00" then text = " 0.00" end
979+ -- 2 decimals ("1,50", "1,25"), none on whole-number sliders ("12"), with the decimal comma in
980+ -- every panel language except English.
981+ local function FormatNumber (value , step )
982+ local whole = step and step >= 1 and step % 1 == 0
983+ local text = whole and string.format (" %d" , math.floor (value + 0.5 )) or string.format (" %.2f" , value )
984+ if text == " -0.00" then text = " 0.00" elseif text == " -0" then text = " 0" end
984985 local lang = root and root .language
985986 if lang == nil or lang == " auto" then lang = GetLocale () end
986987 if lang ~= " enUS" and lang ~= " enGB" then text = text :gsub (" %." , " ," ) end
@@ -1012,7 +1013,7 @@ local function AddSlider(parent, labelKey, settingKey, low, high, step, x, y, fo
10121013 input :SetFontObject (" GameFontHighlightSmall" )
10131014 -- Text set while the box is hidden stays scrolled to its end and looks empty: rewind it.
10141015 local function ShowValue (value )
1015- input :SetText (FormatNumber (value ))
1016+ input :SetText (FormatNumber (value , step ))
10161017 input :SetCursorPosition (0 )
10171018 end
10181019 input :SetScript (" OnShow" , function () ShowValue (db [settingKey ]) end )
0 commit comments