getProperty() and setProperty() #80

Merged
thesabinelim merged 22 commits from get-set-property into master 2023-05-16 01:24:16 +08:00
3 changed files with 20 additions and 2 deletions
Showing only changes of commit 84b3263ff2 - Show all commits

View File

@@ -25,18 +25,30 @@ return function(name, basalt)
return base return base
end, end,
getHorizontalAlign = function(self)
return textHorizontalAlign
end,
setHorizontalAlign = function(self, pos) setHorizontalAlign = function(self, pos)
textHorizontalAlign = pos textHorizontalAlign = pos
self:updateDraw() self:updateDraw()
return self return self
end, end,
getVerticalAlign = function(self)
return textVerticalAlign
end,
setVerticalAlign = function(self, pos) setVerticalAlign = function(self, pos)
textVerticalAlign = pos textVerticalAlign = pos
self:updateDraw() self:updateDraw()
return self return self
end, end,
getText = function(self)
return text
end,
setText = function(self, newText) setText = function(self, newText)
text = newText text = newText
self:updateDraw() self:updateDraw()

View File

@@ -77,6 +77,12 @@ return function(name, basalt)
return self return self
end, end,
--- Gets the text alignment of the label.
--- @return string
getTextAlign = function(self)
return textAlign
end,
--- Sets the text alignment of the label. --- Sets the text alignment of the label.
--- @param align string The alignment of the text. Can be "left", "center", or "right". --- @param align string The alignment of the text. Can be "left", "center", or "right".
--- @return object --- @return object

View File

@@ -475,7 +475,7 @@ return {
base.setValuesByXMLData(self, data, renderContext) base.setValuesByXMLData(self, data, renderContext)
self:updateSpecifiedValuesByXMLData(data, { self:updateSpecifiedValuesByXMLData(data, {
"text", "text",
"align" "textAlign"
}) })
return self return self
end, end,