Resort overview every 30seconds

This commit is contained in:
Max
2026-06-01 04:23:27 +02:00
parent acfc5e7324
commit 4f623656bb
+14 -4
View File
@@ -404,8 +404,11 @@ end
drawOverview = function() drawOverview = function()
local items = getBaseItemIds() local items = getBaseItemIds()
local itemCounts = getMeItemCounts(items)
local sortedItemIds = {} local sortedItemIds = {}
local visibleItemCount = 0
local function renderOverview()
local itemCounts = getMeItemCounts(items)
for i = 1, #items do for i = 1, #items do
sortedItemIds[i] = items[i] sortedItemIds[i] = items[i]
@@ -422,7 +425,7 @@ drawOverview = function()
return a < b return a < b
end) end)
local visibleItemCount = math.min(#sortedItemIds, 9) visibleItemCount = math.min(#sortedItemIds, 9)
frame.buffer:clear() frame.buffer:clear()
@@ -435,11 +438,18 @@ drawOverview = function()
assertBufferValid(frame) assertBufferValid(frame)
frame:drawBuffer() frame:drawBuffer()
end
renderOverview()
local refreshTimer = os.startTimer(30)
while true do while true do
local _, side, x, y = os.pullEvent("monitor_touch") local event, p1, x, y = os.pullEvent()
if side == monName then if event == "timer" and p1 == refreshTimer then
renderOverview()
refreshTimer = os.startTimer(30)
elseif event == "monitor_touch" and p1 == monName then
local col = math.floor((x - 4) / 12) local col = math.floor((x - 4) / 12)
local row = math.floor((y - 2) / 6) local row = math.floor((y - 2) / 6)