core/menusystem: fix widget size in gridbox

This commit is contained in:
Kazhnuz 2019-02-13 19:07:44 +01:00
parent 7d42991d7a
commit 864c1c31a3

View file

@ -5,13 +5,13 @@ local GridBox = Menu:extend()
function GridBox:new(menusystem, name, x, y, w, h, colNumber, lineNumber)
self.view = {}
self.view.slotNumber = colNumber * lineNumber
self.view.colNumber = colNumber
self.view.colNumber = lineNumber
self.view.slotNumber = colNumber * lineNumber
self.view.colNumber = colNumber
self.view.lineNumber = lineNumber
GridBox.super.new(self, menusystem, name, x, y, w, h)
self.begin = 1
self.h = lineNumber * self.widget.h -- On fait en sorte que la hauteur
self.w = colNumber * self.widget.w -- et la largeur
self.w = colNumber * self.widget.w -- et la largeur
-- soit un multiple du nombre de slot et de leur dimensions
self.cursor = {}
self.cursor.x = 0
@ -30,13 +30,13 @@ function GridBox:new(menusystem, name, x, y, w, h, colNumber, lineNumber)
end
function GridBox:updateWidgetSize()
self.widget.h = math.floor( self.h / self.view.colNumber )
self.widget.h = math.floor( self.h / self.view.lineNumber )
self.widget.w = math.floor( self.w / self.view.colNumber )
end
function GridBox:getWidgetSize(id)
local slot = self:getWidgetSlot(id)
return self.slots[slot].width, self.slots[slot].height
return self.widget.w * self.slots[slot].width, self.widget.h * self.slots[slot].height
end
function GridBox:getWidgetSlot(widgetID)