From c6d792974115c794fa4884ff293327a0024825a9 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Fri, 8 Jul 2022 21:06:12 +0200 Subject: [PATCH] small bugfix --- Basalt/main.lua | 6 ++++-- Basalt/objects/Label.lua | 9 +++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Basalt/main.lua b/Basalt/main.lua index e5e7ce4..0f58928 100644 --- a/Basalt/main.lua +++ b/Basalt/main.lua @@ -64,8 +64,10 @@ local bInstance = { } local function drawFrames() - mainFrame:draw() - mainFrame:drawUpdate() + if(mainFrame~=nil)then + mainFrame:draw() + mainFrame:drawUpdate() + end for _,v in pairs(monFrames)do v:draw() v:drawUpdate() diff --git a/Basalt/objects/Label.lua b/Basalt/objects/Label.lua index 289dfac..e2fcc44 100644 --- a/Basalt/objects/Label.lua +++ b/Basalt/objects/Label.lua @@ -86,9 +86,10 @@ return function(name) local splittedText = utils.splitString(self:getValue(), " ") local text = {} local line = "" - for _,v in pairs(splittedText)do + for k,v in pairs(splittedText)do if(line:len()+v:len()<=self.width)then line = line=="" and v or line.." "..v + if(k==#splittedText)then table.insert(text, line) end else table.insert(text, line) line = v:sub(1,self.width) @@ -98,11 +99,7 @@ return function(name) self.parent:setText(obx, oby+k-1, v) end else - for n = 1, self.height do - if (n == verticalAlign) then - self.parent:setText(obx, oby + (n - 1), utils.getTextHorizontalAlign(self:getValue(), self.width, textHorizontalAlign)) - end - end + self.parent:setText(obx, oby, utils.getTextHorizontalAlign(self:getValue(), self.width, textHorizontalAlign)) end else local tData = bigFont(fontsize, self:getValue(), self.fgColor, self.bgColor or colors.black)