Fix padding implementation
This commit is contained in:
parent
925501a486
commit
3d1da9177a
@ -8,6 +8,17 @@ local Padding = Element:new{
|
|||||||
element = nil
|
element = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Padding:new(opts)
|
||||||
|
local obj = Element.new(self, opts)
|
||||||
|
obj.element:setPos(obj:getPaddingLeft(), obj:getPaddingTop())
|
||||||
|
obj:resize{
|
||||||
|
width = obj:getWidth(),
|
||||||
|
height = obj:getHeight()
|
||||||
|
}
|
||||||
|
obj.element:setParent(obj:_getWindow())
|
||||||
|
return obj
|
||||||
|
end
|
||||||
|
|
||||||
function Padding:resize(opts)
|
function Padding:resize(opts)
|
||||||
-- Un-pad dimensions and pass to child element
|
-- Un-pad dimensions and pass to child element
|
||||||
return self.element:resize{
|
return self.element:resize{
|
||||||
@ -16,6 +27,13 @@ function Padding:resize(opts)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Padding:draw()
|
||||||
|
Element.draw(self)
|
||||||
|
local win = self:_getWindow()
|
||||||
|
win.clear()
|
||||||
|
self.element:draw()
|
||||||
|
end
|
||||||
|
|
||||||
function Padding:getPaddingLeft()
|
function Padding:getPaddingLeft()
|
||||||
return self.left
|
return self.left
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user