core/menusystem: get widget size when redrawing and not at start

It's only relevant when drawing/redrawing
This commit is contained in:
Kazhnuz 2019-02-13 18:52:18 +01:00
parent 70853353bb
commit 7d42991d7a

View file

@ -12,8 +12,6 @@ function BaseWidget:new(menu)
self:register() self:register()
self.width, self.height = self.menu:getWidgetSize()
self.canvas = {} self.canvas = {}
self.canvas.texture = nil self.canvas.texture = nil
self.canvas.needRedraw = true self.canvas.needRedraw = true
@ -24,6 +22,8 @@ function BaseWidget:register()
end end
function BaseWidget:redrawCanvas() function BaseWidget:redrawCanvas()
self.width, self.height = self.menu:getWidgetSize(self.id)
self.canvas.texture = love.graphics.newCanvas(self.width, self.height) self.canvas.texture = love.graphics.newCanvas(self.width, self.height)
love.graphics.setCanvas( self.canvas.texture ) love.graphics.setCanvas( self.canvas.texture )