mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-22 15:46:56 +00:00
added some nil checks for api.lua
This commit is contained in:
+6
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user