core/menusystem: add the getWidgetSize function to GridBox

This commit is contained in:
Kazhnuz 2019-02-13 18:35:13 +01:00
parent 8c53f69663
commit 6fb00518bb

View file

@ -33,6 +33,22 @@ function GridBox:updateWidgetSize()
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
end
function GridBox:getWidgetSlot(widgetID)
local slot = 0
for i,v in ipairs(self.slots) do
if (self.slots[i].widgetID == widgetID) then
slot = i
end
end
return slot
end
function GridBox:update(dt)
self.begin = 1
local slotID = self:getSlotbyCoord(self.cursor.x, self.cursor.y)