core/menusystem: add the getWidgetSize function to GridBox
This commit is contained in:
parent
8c53f69663
commit
6fb00518bb
1 changed files with 16 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue