Allow resizing padding
This commit is contained in:
parent
233d3119e5
commit
05116679d2
@ -60,6 +60,26 @@ function Padding:getPaddingBottom()
|
||||
return self.bottom
|
||||
end
|
||||
|
||||
local function compareSet(value, default, didChange)
|
||||
return value or default, didChange or (value ~= nil and value ~= default)
|
||||
end
|
||||
|
||||
function Padding:setPadding(opts)
|
||||
if type(opts) ~= "table" then
|
||||
return
|
||||
end
|
||||
|
||||
local changed = false
|
||||
self.left, changed = compareSet(opts.left, self.left, changed)
|
||||
self.right, changed = compareSet(opts.right, self.right, changed)
|
||||
self.top, changed = compareSet(opts.top, self.top, changed)
|
||||
self.bottom, changed = compareSet(opts.bottom, self.bottom, changed)
|
||||
|
||||
if changed then
|
||||
self:_reload()
|
||||
end
|
||||
end
|
||||
|
||||
function Padding:getInnerWidth()
|
||||
return self.element:getWidth()
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user