From 84b3263ff2d57483785f79ba6332f80de4bfcf50 Mon Sep 17 00:00:00 2001 From: Sabine Lim Date: Tue, 16 May 2023 02:29:35 +1000 Subject: [PATCH] Update Button and Label --- Basalt/objects/Button.lua | 14 +++++++++++++- Basalt/objects/Label.lua | 6 ++++++ Basalt/plugins/xml.lua | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Basalt/objects/Button.lua b/Basalt/objects/Button.lua index e5659f4..f2a5d3b 100644 --- a/Basalt/objects/Button.lua +++ b/Basalt/objects/Button.lua @@ -23,7 +23,11 @@ return function(name, basalt) getBase = function(self) return base - end, + end, + + getHorizontalAlign = function(self) + return textHorizontalAlign + end, setHorizontalAlign = function(self, pos) textHorizontalAlign = pos @@ -31,12 +35,20 @@ return function(name, basalt) return self end, + getVerticalAlign = function(self) + return textVerticalAlign + end, + setVerticalAlign = function(self, pos) textVerticalAlign = pos self:updateDraw() return self end, + getText = function(self) + return text + end, + setText = function(self, newText) text = newText self:updateDraw() diff --git a/Basalt/objects/Label.lua b/Basalt/objects/Label.lua index 160558c..f25b86c 100644 --- a/Basalt/objects/Label.lua +++ b/Basalt/objects/Label.lua @@ -77,6 +77,12 @@ return function(name, basalt) return self end, + --- Gets the text alignment of the label. + --- @return string + getTextAlign = function(self) + return textAlign + end, + --- Sets the text alignment of the label. --- @param align string The alignment of the text. Can be "left", "center", or "right". --- @return object diff --git a/Basalt/plugins/xml.lua b/Basalt/plugins/xml.lua index 32223c1..5d0ee5b 100644 --- a/Basalt/plugins/xml.lua +++ b/Basalt/plugins/xml.lua @@ -475,7 +475,7 @@ return { base.setValuesByXMLData(self, data, renderContext) self:updateSpecifiedValuesByXMLData(data, { "text", - "align" + "textAlign" }) return self end,