Skip to content

Commit 8f2e191

Browse files
authored
Border Bugfix for Buttons
Small visual fix for buttons, when using borders
1 parent 15d8cb3 commit 8f2e191

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Basalt/objects/Button.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ return function(name)
6060

6161
for n = 1, h do
6262
if (n == verticalAlign) then
63-
self.parent:setText(obx, oby + (n - 1), utils.getTextHorizontalAlign(self:getValue(), w, textHorizontalAlign))
64-
self.parent:setFG(obx, oby + (n - 1), utils.getTextHorizontalAlign(tHex[self.fgColor]:rep(self:getValue():len()), w, textHorizontalAlign))
63+
local val = self:getValue()
64+
self.parent:setText(obx + (w/2-val:len()/2), oby + (n - 1), utils.getTextHorizontalAlign(val, val:len(), textHorizontalAlign))
65+
self.parent:setFG(obx + (w/2-val:len()/2), oby + (n - 1), utils.getTextHorizontalAlign(tHex[self.fgColor]:rep(val:len()), val:len(), textHorizontalAlign))
6566
end
6667
end
6768
end
@@ -70,4 +71,4 @@ return function(name)
7071

7172
}
7273
return setmetatable(object, base)
73-
end
74+
end

0 commit comments

Comments
 (0)