adjust tooltip generation - use even numbers of 5

This commit is contained in:
Brandon 2020-07-16 21:02:21 -04:00
parent 850edb564d
commit 5e77c90bb7

View File

@ -15,10 +15,14 @@ local function time_string(dur)
return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60)) return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))
end end
local function perc_string(num) local function perc_string(num)
local rem = math.floor((num-1.0)*100 + 0.1) % 5
local out = math.floor((num-1.0)*100 + 0.1) - rem
if (num - 1.0) < 0 then if (num - 1.0) < 0 then
return math.floor((num-1.0)*100 + 0.1).."%" return out.."%"
else else
return "+"..math.floor((num-1.0)*100 + 0.1).."%" return "+"..out.."%"
end end
end end