mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
Bugfixes: removed hard nil val checks from toolkit.lua fixed few mismatches causing crashes
This commit is contained in:
+19
-5
@@ -45,22 +45,26 @@ local function GetTemplate(t, isUnitFrameElement)
|
||||
end
|
||||
|
||||
function E:Size(frame, width, height)
|
||||
if not frame then return end
|
||||
assert(width)
|
||||
frame:SetWidth(E:Scale(width))
|
||||
frame:SetHeight(E:Scale(height or width))
|
||||
end
|
||||
|
||||
function E:Width(frame, width)
|
||||
if not frame then return end
|
||||
assert(width)
|
||||
frame:SetWidth(E:Scale(width))
|
||||
end
|
||||
|
||||
function E:Height(frame, height)
|
||||
if not frame then return end
|
||||
assert(height)
|
||||
frame:SetHeight(E:Scale(height))
|
||||
end
|
||||
|
||||
function E:Point(obj, arg1, arg2, arg3, arg4, arg5)
|
||||
if not obj then return end
|
||||
if arg2 == nil then arg2 = obj:GetParent() end
|
||||
|
||||
if type(arg2)=="number" then arg2 = E:Scale(arg2) end
|
||||
@@ -77,7 +81,7 @@ function E:SetOutside(obj, anchor, xOffset, yOffset, anchor2)
|
||||
yOffset = yOffset or E.Border
|
||||
anchor = anchor or obj:GetParent()
|
||||
|
||||
assert(anchor)
|
||||
if not anchor then return end
|
||||
if obj:GetPoint() then
|
||||
obj:ClearAllPoints()
|
||||
end
|
||||
@@ -92,7 +96,7 @@ function E:SetInside(obj, anchor, xOffset, yOffset, anchor2)
|
||||
yOffset = yOffset or E.Border
|
||||
anchor = anchor or obj:GetParent()
|
||||
|
||||
assert(anchor)
|
||||
if not anchor then return end
|
||||
if obj:GetPoint() then
|
||||
obj:ClearAllPoints()
|
||||
end
|
||||
@@ -102,7 +106,7 @@ function E:SetInside(obj, anchor, xOffset, yOffset, anchor2)
|
||||
end
|
||||
|
||||
function E:SetTemplate(f, t, glossTex, ignoreUpdates, forcePixelMode, isUnitFrameElement)
|
||||
if not f then return end
|
||||
if not f or type(f) ~= "table" then return end
|
||||
GetTemplate(t, isUnitFrameElement)
|
||||
|
||||
if t then
|
||||
@@ -187,6 +191,7 @@ function E:SetTemplate(f, t, glossTex, ignoreUpdates, forcePixelMode, isUnitFram
|
||||
end
|
||||
|
||||
function E:CreateBackdrop(f, t, tex, ignoreUpdates, forcePixelMode, isUnitFrameElement)
|
||||
if not f then return end
|
||||
if not t then t = "Default" end
|
||||
|
||||
local parent = f
|
||||
@@ -199,8 +204,16 @@ function E:CreateBackdrop(f, t, tex, ignoreUpdates, forcePixelMode, isUnitFrameE
|
||||
if parent and parent.IsObjectType and not parent:IsObjectType("Frame") then
|
||||
parent = UIParent
|
||||
end
|
||||
if not parent or type(parent) ~= "table" or not parent.GetObjectType then
|
||||
parent = UIParent
|
||||
end
|
||||
|
||||
local b = f.backdrop or CreateFrame("Frame", nil, parent)
|
||||
local b = (type(f.backdrop) == "table" and f.backdrop)
|
||||
if not b then
|
||||
b = CreateFrame("Frame", nil)
|
||||
pcall(function() b:SetParent(parent) end)
|
||||
end
|
||||
|
||||
if f.forcePixelMode or forcePixelMode then
|
||||
E:SetOutside(b, nil, E.mult, E.mult)
|
||||
else
|
||||
@@ -247,7 +260,8 @@ function E:Kill(object)
|
||||
end
|
||||
|
||||
function E:StripTextures(object, kill, alpha)
|
||||
if object:IsObjectType("Texture") then
|
||||
if not object or type(object) ~= "table" then return end
|
||||
if object.IsObjectType and object:IsObjectType("Texture") then
|
||||
if kill then
|
||||
E:Kill(object)
|
||||
elseif alpha then
|
||||
|
||||
Reference in New Issue
Block a user