Simplify layout setup

This commit is contained in:
Gabriel Tofvesson 2024-10-12 04:52:40 +02:00
parent 82e0044ba0
commit 2e622295b8

View File

@ -499,8 +499,6 @@ local PAGES = {
id = "data_divider",
top = 0,
bottom = 0,
left = math.floor((state.width - (PADDING_RQC_H * 2) - #tostring(pageState.request) - #tostring(group:getItemCount())) / 2),
right = math.ceil((state.width - (PADDING_RQC_H * 2) - #tostring(pageState.request) - #tostring(group:getItemCount())) / 2),
element = Text:new{ text = "/" }
},
Text:new{ id = "data_available", text = tostring(group:getItemCount()) },
@ -557,12 +555,15 @@ local PAGES = {
local dataAvailableText = paddedRequestCount:findById("data_available")
local requestCapProgress = paddedRequestCount:findById("request_capacity")
dataRequestText:setText(tostring(pageState.request))
local requestText = tostring(pageState.request)
local availableText = tostring(group:getItemCount())
dataRequestText:setText(requestText)
dataDividerPad:setPadding{
left = math.floor((state.width - (PADDING_RQC_H * 2) - #tostring(pageState.request) - #tostring(group:getItemCount())) / 2),
right = math.ceil((state.width - (PADDING_RQC_H * 2) - #tostring(pageState.request) - #tostring(group:getItemCount())) / 2)
left = math.ceil((state.width - 1 - (PADDING_RQC_H * 2) - #requestText - #availableText) / 2),
right = math.floor((state.width - 1 - (PADDING_RQC_H * 2) - #requestText - #availableText) / 2)
}
dataAvailableText:setText(tostring(group:getItemCount()))
dataAvailableText:setText(availableText)
requestCapProgress:setProgress(pageState.request / group:getItemCount())
stuffContainer:setDirty(true)
@ -585,6 +586,8 @@ local PAGES = {
bindRequestButton(1)
bindRequestButton(5)
updateDisplayState()
return renderDefault(state, stuffContainer)
end
}