From 4005b937ee527d7c17ffc204f35c66164807b3e1 Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Tue, 8 Oct 2024 19:32:43 +0200 Subject: [PATCH] Fix btnNext left-pad --- itemcontroller.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/itemcontroller.lua b/itemcontroller.lua index 8854836..a89da2c 100644 --- a/itemcontroller.lua +++ b/itemcontroller.lua @@ -113,17 +113,21 @@ local function itemList(groups, wBudget, hBudget, savedState, onClick, setPage, end } + local padImport = Padding:new{ + left = math.floor((wBudget - btnPrev:getWidth() - btnNext:getWidth() - btnImport:getWidth())/2), + element = btnImport + } + + local padNext = Padding:new{ + left = wBudget - btnPrev:getWidth() - padImport:getWidth() - btnNext:getWidth(), + element = btnNext + } + local tabLine = List:new{ children = { btnPrev, - Padding:new{ - left = math.floor((wBudget - btnPrev:getWidth() - btnNext:getWidth() - btnImport:getWidth())/2), - element = btnImport - }, - Padding:new{ - left = wBudget - btnPrev:getWidth() - btnImport:getWidth() - btnNext:getWidth(), - element = btnNext - } + padImport, + padNext }, vertical = false } @@ -247,7 +251,7 @@ local PAGES = { print("Importing...") -- Safely handle transfers, priming computer for a full reset/rescan in case server stops mid-transaction state:itemTransaction(function() - for _,nodeStack in state.node:find(function(s) return not s:isEmpty() end) do + for _,nodeStack in ipairs(state.node:find(function(s) return not s:isEmpty() end)) do if not state.controller:insertStack(nodeStack) then print("Couldn't find a free slot for: "..(nodeStack:getDisplayName() or nodeStack:getName() or "[EMPTY]")) end