From f05f2c76f0dfe18a2dd34bee6cd14a86de7ac5a8 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 17 Mar 2019 07:45:27 +0100 Subject: [PATCH] Improve offsets for text widget, add black bg box --- init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index c756390..dcb4c78 100644 --- a/init.lua +++ b/init.lua @@ -487,7 +487,7 @@ doc.widgets.text = function(data, x, y, width, height) x = doc.FORMSPEC.ENTRY_START_X end -- 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 y = doc.FORMSPEC.ENTRY_START_Y end @@ -497,8 +497,12 @@ doc.widgets.text = function(data, x, y, width, height) if height == nil then height = doc.FORMSPEC.ENTRY_HEIGHT 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 end