removed scrollbar from tables

added enabled property
This commit is contained in:
Robert Jelic
2025-06-22 04:17:14 +02:00
parent 1b467c4d4a
commit 8fd37ee1fe
9 changed files with 291 additions and 222 deletions

View File

@@ -216,7 +216,7 @@ function Table:render()
local finalText = string.sub(paddedText, 1, col.width)
local finalForeground = string.rep(tHex[self.get("foreground")], #finalText)
local finalBackground = string.rep(tHex[bg], #finalText)
self:blit(currentX, y, finalText, finalForeground, finalBackground)
currentX = currentX + col.width
end
@@ -226,27 +226,6 @@ function Table:render()
string.rep(tHex[self.get("background")], self.get("width")))
end
end
if #data > height - 2 then
local scrollbarHeight = height - 2
local thumbSize = math.max(1, math.floor(scrollbarHeight * (height - 2) / #data))
local maxScroll = #data - (height - 2) + 1
local scrollPercent = scrollOffset / maxScroll
local thumbPos = 2 + math.floor(scrollPercent * (scrollbarHeight - thumbSize))
if scrollOffset >= maxScroll then
thumbPos = height - thumbSize
end
for y = 2, height do
self:blit(self.get("width"), y, "\127", tHex[colors.gray], tHex[colors.gray])
end
for y = thumbPos, math.min(height, thumbPos + thumbSize - 1) do
self:blit(self.get("width"), y, "\127", tHex[colors.white], tHex[colors.white])
end
end
end
return Table