fix: correct progress bar width

This commit is contained in:
2025-11-29 14:45:41 +01:00
parent 595c4e6fcc
commit 53d60f4a6d

View File

@@ -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)
if fgWidth > 0 then
paintutils.drawLine(x, y, x + fgWidth - 1, y, fg) paintutils.drawLine(x, y, x + fgWidth - 1, y, fg)
end
term.setBackgroundColor(colors.black) term.setBackgroundColor(colors.black)
end end