i'm trying to figure out why i'm getting odd occurrences with the below code, hopefully someone can help me fix it up.
originally CreateTexture's strata was set to BACKGROUND, but i wanted to overlap when channeling so i set it to LOW, seems to work if I do a regular cast 1st on a fresh /reload ui, but if i start off with a channeling spell, the texture goes over top of everything till i /reload ui
Code:
local lagmeter = CastingBarFrame:CreateTexture(nil, "LOW")
lagmeter:SetHeight(CastingBarFrame:GetHeight())
lagmeter:SetWidth(0)
lagmeter:SetPoint("RIGHT", CastingBarFrame, "RIGHT", 0, 0)
lagmeter:SetColorTexture(1, 0, 0, 1)
hooksecurefunc(CastingBarFrame, "Show", function()
local _, _, _, lag = GetNetStats()
local castingmin, castingmax = CastingBarFrame:GetMinMaxValues()
local lagvalue = ( lag / 1000 ) / ( castingmax - castingmin )
local channeling = CastingBarFrame.channeling
if ( lagvalue < 0 ) then
lagvalue = 0
elseif ( lagvalue > 1 ) then
lagvalue = 1
end
lagmeter:ClearAllPoints()
lagmeter:SetWidth(CastingBarFrame:GetWidth() * lagvalue)
if channeling then
lagmeter:SetPoint("LEFT")
else
lagmeter:SetPoint("RIGHT")
end
end)