From 958b962ada41784f59cc134e15d6d8dd3a6ad7c8 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Sat, 17 Jun 2023 18:02:50 +0200 Subject: [PATCH] Update Label.lua Small fix when calculating the size for labels --- Basalt/objects/Label.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Basalt/objects/Label.lua b/Basalt/objects/Label.lua index 0db5c92..130d434 100644 --- a/Basalt/objects/Label.lua +++ b/Basalt/objects/Label.lua @@ -14,11 +14,12 @@ return function(name, basalt) local autoSize = self:getAutoSize() if(autoSize)then local t = wrapText(value, #value) - local newW, newH = 1,1 + local newW, newH = 1,0 for _,v in pairs(t)do - newH = newH+1 + newH = newH + 1 newW = math.max(newW, v:len()) end + if(newH==0)then newH = 1 end self:setSize(newW, newH) self:setAutoSize(true) end @@ -64,4 +65,4 @@ return function(name, basalt) object.__index = object return setmetatable(object, base) -end \ No newline at end of file +end