diff --git a/api/api.lua b/api/api.lua index 5a3c88d1..95bdbd14 100644 --- a/api/api.lua +++ b/api/api.lua @@ -1233,7 +1233,9 @@ end function pfUI.api.BarLayoutSize(bar,barsize,formfactor,iconsize,bordersize,padding) assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarLayoutSize: barsize "..tostring(barsize).." is invalid") local formfactor = pfUI.api.BarLayoutFormfactor(formfactor) - local cols, rows = unpack(pfGridmath[barsize][formfactor]) + local layout = pfGridmath[barsize] and pfGridmath[barsize][formfactor or 1] + if not layout then layout = pfGridmath[barsize] and pfGridmath[barsize][1] or {1,1} end + local cols, rows = unpack(layout) local width = (iconsize + bordersize*2+padding) * cols + padding local height = (iconsize + bordersize*2+padding) * rows + padding bar._size = {width,height} @@ -1252,7 +1254,9 @@ function pfUI.api.BarButtonAnchor(button,basename,buttonindex,barsize,formfactor assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarButtonAnchor: barsize "..tostring(barsize).." is invalid") local formfactor = pfUI.api.BarLayoutFormfactor(formfactor) local parent = button:GetParent() - local cols, rows = unpack(pfGridmath[barsize][formfactor]) + local layout = pfGridmath[barsize] and pfGridmath[barsize][formfactor or 1] + if not layout then layout = pfGridmath[barsize] and pfGridmath[barsize][1] or {1,1} end + local cols, rows = unpack(layout) if buttonindex == 1 then button._anchor = {"TOPLEFT", parent, "TOPLEFT", bordersize+padding, -bordersize-padding} else