Improve offsets for text widget, add black bg box

This commit is contained in:
Wuzzy 2019-03-17 07:45:27 +01:00
parent 8d0489cde1
commit f05f2c76f0

View File

@ -487,7 +487,7 @@ doc.widgets.text = function(data, x, y, width, height)
x = doc.FORMSPEC.ENTRY_START_X x = doc.FORMSPEC.ENTRY_START_X
end end
-- Offset to table[], which was used for this in a previous version -- Offset to table[], which was used for this in a previous version
x = x + 0.35 local xfix = x + 0.35
if y == nil then if y == nil then
y = doc.FORMSPEC.ENTRY_START_Y y = doc.FORMSPEC.ENTRY_START_Y
end end
@ -497,8 +497,12 @@ doc.widgets.text = function(data, x, y, width, height)
if height == nil then if height == nil then
height = doc.FORMSPEC.ENTRY_HEIGHT height = doc.FORMSPEC.ENTRY_HEIGHT
end end
-- Weird offset for textarea[]
local heightfix = height + 1
local formstring = "textarea["..tostring(x)..","..tostring(y)..";"..tostring(width)..","..tostring(height)..";;;"..minetest.formspec_escape(data).."]" -- Also add background box
local formstring = "box["..tostring(x-0.175)..","..tostring(y)..";"..tostring(width)..","..tostring(height)..";#000000]" ..
"textarea["..tostring(xfix)..","..tostring(y)..";"..tostring(width)..","..tostring(heightfix)..";;;"..minetest.formspec_escape(data).."]"
return formstring return formstring
end end