mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2024-12-30 12:40:23 +01:00
Fix crafting guide grid button sizes for size>4
This commit is contained in:
parent
5c57915159
commit
f8082a0e35
@ -188,7 +188,7 @@ local function stack_image_button(x, y, w, h, buttonname_prefix, item)
|
|||||||
selectitem = group_item.sole and displayitem or name
|
selectitem = group_item.sole and displayitem or name
|
||||||
end
|
end
|
||||||
local label = show_is_group and "G" or ""
|
local label = show_is_group and "G" or ""
|
||||||
return string.format("item_image_button[%f,%f;%u,%u;%s;%s;%s]",
|
return string.format("item_image_button[%f,%f;%f,%f;%s;%s;%s]",
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
minetest.formspec_escape(displayitem),
|
minetest.formspec_escape(displayitem),
|
||||||
minetest.formspec_escape(buttonname_prefix..unified_inventory.mangle_for_formspec(selectitem)),
|
minetest.formspec_escape(buttonname_prefix..unified_inventory.mangle_for_formspec(selectitem)),
|
||||||
@ -288,10 +288,8 @@ unified_inventory.register_page("craftguide", {
|
|||||||
-- Offset factor for crafting grids with side length > 4
|
-- Offset factor for crafting grids with side length > 4
|
||||||
local of = (3/math.max(3, math.max(display_size.width, display_size.height)))
|
local of = (3/math.max(3, math.max(display_size.width, display_size.height)))
|
||||||
-- Size modifier factor
|
-- Size modifier factor
|
||||||
local sf = math.min(1, of * 1.5)
|
local sf = math.min(1, of * 1.05)
|
||||||
local bsize = 1.1 * sf
|
local bsize = 1.1 * sf
|
||||||
-- Ugly hack because for some reason image_buttons don't have the same size as item_image_buttons ...
|
|
||||||
local fakesize = bsize - 0.1
|
|
||||||
for y = 1, display_size.height do
|
for y = 1, display_size.height do
|
||||||
for x = display_size.width,1,-1 do
|
for x = display_size.width,1,-1 do
|
||||||
local item
|
local item
|
||||||
@ -309,7 +307,7 @@ unified_inventory.register_page("craftguide", {
|
|||||||
-- Fake buttons just to make grid
|
-- Fake buttons just to make grid
|
||||||
formspec = formspec.."image_button["
|
formspec = formspec.."image_button["
|
||||||
..tostring(xoffset - xof)..","..tostring(formspecy - 1 + yof)
|
..tostring(xoffset - xof)..","..tostring(formspecy - 1 + yof)
|
||||||
..";"..fakesize..","..fakesize..";ui_blank_image.png;;]"
|
..";"..bsize..","..bsize..";ui_blank_image.png;;]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user