From 8f2e191fe32ac3c2b537f696dde247f1e2929235 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Mon, 21 Nov 2022 06:23:13 +0100 Subject: [PATCH] Border Bugfix for Buttons Small visual fix for buttons, when using borders --- Basalt/objects/Button.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Basalt/objects/Button.lua b/Basalt/objects/Button.lua index 6ae68b1..5e84122 100644 --- a/Basalt/objects/Button.lua +++ b/Basalt/objects/Button.lua @@ -60,8 +60,9 @@ return function(name) for n = 1, h do if (n == verticalAlign) then - self.parent:setText(obx, oby + (n - 1), utils.getTextHorizontalAlign(self:getValue(), w, textHorizontalAlign)) - self.parent:setFG(obx, oby + (n - 1), utils.getTextHorizontalAlign(tHex[self.fgColor]:rep(self:getValue():len()), w, textHorizontalAlign)) + local val = self:getValue() + self.parent:setText(obx + (w/2-val:len()/2), oby + (n - 1), utils.getTextHorizontalAlign(val, val:len(), textHorizontalAlign)) + self.parent:setFG(obx + (w/2-val:len()/2), oby + (n - 1), utils.getTextHorizontalAlign(tHex[self.fgColor]:rep(val:len()), val:len(), textHorizontalAlign)) end end end @@ -70,4 +71,4 @@ return function(name) } return setmetatable(object, base) -end \ No newline at end of file +end