Fix contents scrollbar in guide

This commit is contained in:
2025-12-06 23:15:42 +01:00
parent cd585391ec
commit c7ff88087e

View File

@@ -1436,17 +1436,18 @@ local function preprocessHypertext(content,vars)
end end
local function getGuideFormspec(playerName,pageName) local function getGuideFormspec(playerName,pageName)
local PAGE_BUTTON_HEIGHT=0.7
local formspec={ local formspec={
"formspec_version[4]", "formspec_version[4]",
"size[15,10.8]", "size[15,10.8]",
"label[0.1,0.2;"..S("IndustrialTest Guide").."]", "label[0.1,0.2;"..S("IndustrialTest Guide").."]",
--"scrollbaroptions[]", string.format("scrollbaroptions[max=%f]",(#pages-10.3/PAGE_BUTTON_HEIGHT)*PAGE_BUTTON_HEIGHT*10),
"scrollbar[3.6,0.4;0.5,10.3;vertical;scrollbarList;0]", "scrollbar[3.6,0.4;0.5,10.3;vertical;scrollbarList;0]",
"scroll_container[0.1,0.4;4,10.3;scrollbarList;vertical]" "scroll_container[0.1,0.4;4,10.3;scrollbarList;vertical;0.1]"
} }
-- Contents sidebar -- Contents sidebar
local PAGE_BUTTON_HEIGHT=0.7
for i,page in ipairs(pages) do for i,page in ipairs(pages) do
table.insert(formspec,string.format("container[0,%f]",(i-1)*PAGE_BUTTON_HEIGHT)) table.insert(formspec,string.format("container[0,%f]",(i-1)*PAGE_BUTTON_HEIGHT))
table.insert(formspec,string.format("item_image[0,0;%f,%f;%s]",PAGE_BUTTON_HEIGHT,PAGE_BUTTON_HEIGHT,page.icon)) table.insert(formspec,string.format("item_image[0,0;%f,%f;%s]",PAGE_BUTTON_HEIGHT,PAGE_BUTTON_HEIGHT,page.icon))