diff options
author | Wuzzy <almikes@aol.com> | 2015-05-20 00:23:21 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2015-05-20 00:23:21 +0200 |
commit | fb2cf988de91682c7da2c6e4e169b8068d11899a (patch) | |
tree | faa782fb358da13e59b7e7231570b55d6b2360d6 | |
parent | 390c24c1930067bf6ec28a1d8ca933a361d3c7fb (diff) |
Bar length is now rounded towards nearest integer
-rw-r--r-- | init.lua | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -81,9 +81,15 @@ function hb.value_to_barlength(value, max) return 0 else if hb.settings.bar_type == "progress_bar" then - return math.ceil((value/max) * hb.settings.max_bar_length) + local x + if value < 0 then x=-0.5 else x = 0.5 end + local ret = math.modf((value/max) * hb.settings.max_bar_length + x) + return ret else - return math.ceil((value/max) * 20) + local x + if value < 0 then x=-0.5 else x = 0.5 end + local ret = math.modf((value/max) * 20 + x) + return ret end end end |