added larger scroll buttons for formspec versions 1 and 2

This commit is contained in:
Sokomine 2022-09-11 05:17:58 +02:00
parent f825a95fd2
commit d5f628638f

View File

@ -272,6 +272,15 @@ yl_speak_up.show_fs_decorated = function(pname, edit_mode, h,
allow_scrolling = false
end
if(allow_scrolling and fs_version < 3) then
table.insert(formspec, "style_type[button;bgcolor=#FFFFFF]")
table.insert(formspec, "background[45,19.5;9.5,5;yl_speak_up_bg_dialog.png;false]")
table.insert(formspec, "box[45.1,19.6;9.3,4.8;#BBBBBB]")
table.insert(formspec, "image_button[45.5,20;4,4;gui_furnace_arrow_bg.png;button_down;Up]")
table.insert(formspec, "image_button[50,20;4,4;gui_furnace_arrow_bg.png^[transformR180;button_up;Down]")
table.insert(formspec, "style_type[button;bgcolor=#a37e45]")
end
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)..
@ -290,25 +299,27 @@ yl_speak_up.show_fs_decorated = function(pname, edit_mode, h,
table.insert(formspec,
"box[0.3,20;19,2.6;red]"..
"label[0.7,20.3;"..yl_speak_up.text_version_warning.."]")
-- The up and down buttons are microscopic. Offer some (still small)
-- additional text buttons so that players have a chance to hit them.
table.insert(formspec, "button[49,23.1;6,0.9;button_down;^ Scroll Up ^]")
table.insert(formspec, "button[49,31.5;6,0.9;button_up;v Scroll Down v]")
table.insert(formspec, "button[1,23.1;6,0.9;button_down;^ Scroll Up ^]")
table.insert(formspec, "button[1,31.5;6,0.9;button_up;v Scroll Down v]")
-- TODO delete these obsolete buttons
-- -- The up and down buttons are microscopic. Offer some (still small)
-- -- additional text buttons so that players have a chance to hit them.
-- table.insert(formspec, "button[49,23.1;6,0.9;button_down;^ Scroll Up ^]")
-- table.insert(formspec, "button[49,31.5;6,0.9;button_up;v Scroll Down v]")
-- table.insert(formspec, "button[1,23.1;6,0.9;button_down;^ Scroll Up ^]")
-- table.insert(formspec, "button[1,31.5;6,0.9;button_up;v Scroll Down v]")
end
table.insert(formspec, "container[0,24]")
if(fs_version < 2) then
-- very small, ugly, and difficult to hit
table.insert(formspec, "button[0.1,0;1,0.9;button_down;^]")
table.insert(formspec, "button[0.1,7.0;1,0.9;button_up;v]")
else
-- somewhat larger and quite usable (v2 is pretty ok)
table.insert(formspec, "button[0.1,0;1,3;button_down;^\nU\np]")
table.insert(formspec, "button[0.1,3.2;1,4.5;button_up;D\no\nw\nn\nv]")
table.insert(formspec, "button[53.5,0;1,3;button_down;^\nU\np]")
table.insert(formspec, "button[53.5,3.2;1,4.5;button_up;D\no\nw\nn\nv]")
end
-- TODO delete these obsolete buttons
-- if(fs_version < 2) then
-- -- very small, ugly, and difficult to hit
-- table.insert(formspec, "button[0.1,0;1,0.9;button_down;^]")
-- table.insert(formspec, "button[0.1,7.0;1,0.9;button_up;v]")
-- else
-- -- somewhat larger and quite usable (v2 is pretty ok)
-- table.insert(formspec, "button[0.1,0;1,3;button_down;^\nU\np]")
-- table.insert(formspec, "button[0.1,3.2;1,4.5;button_up;D\no\nw\nn\nv]")
-- table.insert(formspec, "button[53.5,0;1,3;button_down;^\nU\np]")
-- table.insert(formspec, "button[53.5,3.2;1,4.5;button_up;D\no\nw\nn\nv]")
-- end
else
table.insert(formspec, "container[0,24]")
end