mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-25 21:40:49 +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)
|
function pfUI.api.BarLayoutSize(bar,barsize,formfactor,iconsize,bordersize,padding)
|
||||||
assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarLayoutSize: barsize "..tostring(barsize).." is invalid")
|
assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarLayoutSize: barsize "..tostring(barsize).." is invalid")
|
||||||
local formfactor = pfUI.api.BarLayoutFormfactor(formfactor)
|
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 width = (iconsize + bordersize*2+padding) * cols + padding
|
||||||
local height = (iconsize + bordersize*2+padding) * rows + padding
|
local height = (iconsize + bordersize*2+padding) * rows + padding
|
||||||
bar._size = {width,height}
|
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")
|
assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarButtonAnchor: barsize "..tostring(barsize).." is invalid")
|
||||||
local formfactor = pfUI.api.BarLayoutFormfactor(formfactor)
|
local formfactor = pfUI.api.BarLayoutFormfactor(formfactor)
|
||||||
local parent = button:GetParent()
|
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
|
if buttonindex == 1 then
|
||||||
button._anchor = {"TOPLEFT", parent, "TOPLEFT", bordersize+padding, -bordersize-padding}
|
button._anchor = {"TOPLEFT", parent, "TOPLEFT", bordersize+padding, -bordersize-padding}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user