From 3d1da9177a2903b3620491e82cbd395669ec4c2f Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Fri, 4 Oct 2024 00:05:45 +0200 Subject: [PATCH] Fix padding implementation --- gfx/padding.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gfx/padding.lua b/gfx/padding.lua index b3337de..6f2ad16 100644 --- a/gfx/padding.lua +++ b/gfx/padding.lua @@ -8,6 +8,17 @@ local Padding = Element:new{ 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) -- Un-pad dimensions and pass to child element return self.element:resize{ @@ -16,6 +27,13 @@ function Padding:resize(opts) } end +function Padding:draw() + Element.draw(self) + local win = self:_getWindow() + win.clear() + self.element:draw() +end + function Padding:getPaddingLeft() return self.left end