fix: correct progress bar width
This commit is contained in:
@@ -5,7 +5,9 @@ function progress.bar(x, y, width, value, max, fg, bg)
|
|||||||
local fgWidth = utils.round(value * width / max)
|
local fgWidth = utils.round(value * width / max)
|
||||||
fgWidth = math.max(0, math.min(width, fgWidth))
|
fgWidth = math.max(0, math.min(width, fgWidth))
|
||||||
paintutils.drawLine(x, y, x + width - 1, y, bg)
|
paintutils.drawLine(x, y, x + width - 1, y, bg)
|
||||||
paintutils.drawLine(x, y, x + fgWidth - 1, y, fg)
|
if fgWidth > 0 then
|
||||||
|
paintutils.drawLine(x, y, x + fgWidth - 1, y, fg)
|
||||||
|
end
|
||||||
term.setBackgroundColor(colors.black)
|
term.setBackgroundColor(colors.black)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user