made scrollbar for options easier to operate
This commit is contained in:
parent
f1668176ad
commit
556c24f782
@ -217,7 +217,7 @@ yl_speak_up.show_fs_decorated = function(pname, edit_mode, h,
|
||||
end
|
||||
|
||||
formspec = {
|
||||
"size[57,33]",
|
||||
"size[58,33]",
|
||||
"position[0,0.45]",
|
||||
"anchor[0,0.45]",
|
||||
"no_prepend[]",
|
||||
@ -228,7 +228,7 @@ yl_speak_up.show_fs_decorated = function(pname, edit_mode, h,
|
||||
-- Background
|
||||
|
||||
"background[0,0;20,23;yl_speak_up_bg_dialog.png;false]",
|
||||
"background[0,24;54.5,7.5;yl_speak_up_bg_dialog.png;false]",
|
||||
"background[0,24;55.6,7.5;yl_speak_up_bg_dialog.png;false]",
|
||||
-- Frame Dialog
|
||||
|
||||
"image[-0.25,-0.25;1,1;yl_speak_up_bg_dialog_tl.png]",
|
||||
@ -243,12 +243,12 @@ yl_speak_up.show_fs_decorated = function(pname, edit_mode, h,
|
||||
|
||||
"image[-0.25,23.75;1,1;yl_speak_up_bg_dialog_tl.png]",
|
||||
"image[-0.25,30.75;1,1;yl_speak_up_bg_dialog_bl.png]",
|
||||
"image[53.75,23.75;1,1;yl_speak_up_bg_dialog_tr.png]",
|
||||
"image[53.75,30.75;1,1;yl_speak_up_bg_dialog_br.png]",
|
||||
"image[54.75,23.75;1,1;yl_speak_up_bg_dialog_tr.png]",
|
||||
"image[54.75,30.75;1,1;yl_speak_up_bg_dialog_br.png]",
|
||||
"image[-0.25,24.75;1,6;yl_speak_up_bg_dialog_hl.png]",
|
||||
"image[53.75,24.75;1,6;yl_speak_up_bg_dialog_hr.png]",
|
||||
"image[0.75,23.75;53,1;yl_speak_up_bg_dialog_vt.png]",
|
||||
"image[0.75,30.75;53,1;yl_speak_up_bg_dialog_vb.png]",
|
||||
"image[54.75,24.75;1,6;yl_speak_up_bg_dialog_hr.png]",
|
||||
"image[0.75,23.75;54,1;yl_speak_up_bg_dialog_vt.png]",
|
||||
"image[0.75,30.75;54,1;yl_speak_up_bg_dialog_vb.png]",
|
||||
|
||||
"label[0.3,0.6;",
|
||||
minetest.formspec_escape(dialog.n_npc),
|
||||
@ -327,11 +327,20 @@ yl_speak_up.show_fs_decorated = function(pname, edit_mode, h,
|
||||
|
||||
if(allow_scrolling and fs_version > 2) then
|
||||
local max_scroll = math.ceil(h - yl_speak_up.max_number_of_buttons) + 1
|
||||
table.insert(formspec, "scrollbaroptions[min=0;max="..tostring(max_scroll)..
|
||||
";smallstep=1;largestep=2;arrows=show".. --]")
|
||||
";thumbsize="..tostring(math.ceil(h/yl_speak_up.max_number_of_buttons)).."]")
|
||||
table.insert(formspec, "scrollbar[0.2,24.2;0.2,7;vertical;scr0;0]")
|
||||
table.insert(formspec, "scroll_container[0,24;56,7;scr0;vertical;1]")
|
||||
-- table.insert(formspec, "scrollbar[0.2,24.2;0.2,7;vertical;scr0;0]")
|
||||
table.insert(formspec, "scrollbaroptions[min=0;max=")
|
||||
table.insert(formspec, tostring(max_scroll*10))
|
||||
table.insert(formspec, ";thumbsize=")
|
||||
table.insert(formspec, tostring(math.ceil(
|
||||
yl_speak_up.max_number_of_buttons /
|
||||
(yl_speak_up.max_number_of_buttons + max_scroll)*max_scroll*10)))
|
||||
table.insert(formspec, ";smallstep=10")
|
||||
table.insert(formspec, ";largestep=")
|
||||
table.insert(formspec, tostring(yl_speak_up.max_number_of_buttons*10))
|
||||
table.insert(formspec, "]")
|
||||
table.insert(formspec, "scrollbar[54.2,24.2;1.2,7.2;vertical;scr0;1]")
|
||||
table.insert(formspec, "scroll_container[-0.2,24;54.2,7;scr0;vertical;0.1]")
|
||||
|
||||
elseif(allow_scrolling) then
|
||||
if(fs_version < 2) then
|
||||
-- if the player has an older formspec version
|
||||
|
Loading…
Reference in New Issue
Block a user