Commit 93054182 authored by Blazeflack's avatar Blazeflack

Fixed NoBorders tweak to work with latest version of ElvUI

This fixes #29, #30
parent 567e1df7
......@@ -25,17 +25,24 @@ local function GetTemplate(t, isUnitFrameElement)
end
end
local BackdropBorders = {"TOPLEFT", "TOPRIGHT", "BOTTOMLEFT", "BOTTOMRIGHT", "TOP", "BOTTOM", "LEFT", "RIGHT"}
local function customBackdropColor(frame, r, g, b, a)
if frame.pixelBorders then
frame.pixelBorders.CENTER:SetVertexColor(r, g, b, 0)
end
end
local function customBackdropBorderColor(frame, r, g, b, a)
if frame.pixelBorders then
for _, v in pairs(BackdropBorders) do
frame.pixelBorders[v]:SetColorTexture(r or 0, g or 0, b or 0, 0)
end
end
end
--Code taken from ElvUI and modified to remove borders
local function SetTemplate(f, t, glossTex, ignoreUpdates, forcePixelMode, isUnitFrameElement)
local function CustomSetTemplate(f, t, glossTex, ignoreUpdates, forcePixelMode, isUnitFrameElement)
GetTemplate(t, isUnitFrameElement)
f:SetBackdrop({
bgFile = glossTex and (type(glossTex) == 'string' and glossTex or E.media.glossTex) or E.media.blankTex,
edgeFile = nil,
tile = false, tileSize = 0, edgeSize = 0,
insets = {left = 0, right = 0, top = 0, bottom = 0}
})
if t ~= 'NoBackdrop' then
f:SetBackdropColor(backdropr, backdropg, backdropb, backdropa)
if not E.PixelMode and not f.forcePixelMode then
......@@ -47,19 +54,22 @@ local function SetTemplate(f, t, glossTex, ignoreUpdates, forcePixelMode, isUnit
end
end
end
f.ignoreBorderColors = true
f:SetBackdropBorderColor(0, 0, 0, 0)
f.ignoreBorderColors = true
if isUnitFrameElement and t ~= "Transparent" then
f:SetBackdropColor(0,0,0,0)
end
hooksecurefunc(f, "SetBackdropBorderColor", customBackdropBorderColor)
end
--Code taken from ElvUI
local function addapi(object)
if not object.isCTHooked then
local mt = getmetatable(object).__index
hooksecurefunc(mt, "SetTemplate", SetTemplate)
hooksecurefunc(mt, "SetTemplate", CustomSetTemplate)
object.isCTHooked = true
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment