chore: make canvas redraw part of canvas

This commit is contained in:
Kazhnuz 2021-08-30 14:07:02 +02:00
parent 339d927d51
commit 6f6b4e6d74
2 changed files with 8 additions and 4 deletions

View file

@ -19,6 +19,13 @@ function CanvasElement:initCanvas()
self.canvas.padding = 8
end
function CanvasElement:updateElement(dt)
CanvasElement.super.updateElement(self, dt)
if (self.canvas.needRedraw or self.canvas.isAnimated) then
self:redraw()
end
end
function CanvasElement:getCanvasDimensions()
return self:getDimensions()
end

View file

@ -140,11 +140,8 @@ end
-- UPDATE FUNCTIONS
function Menu:updateElement(dt)
Menu.super.updateElement(self, dt)
self.widget:update(dt)
if (self.canvas.needRedraw or self.canvas.isAnimated) then
self:redraw()
end
Menu.super.updateElement(self, dt)
end
-- DRAW FUNCTIONS