Skip to content

Commit

Permalink
add new version of LOS fader and enable it again
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanzilla committed Dec 19, 2018
1 parent 6aee68d commit e7246ba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Kui_Stanzilla/Kui_Stanzilla.toc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

kui.colour-bar-by-name.lua
kui.left-layout.lua
#kui.los-fade.lua
kui.los-fade.lua
kui.mythicplus.lua
kui.priority-debuffs.lua
kui.target-name.lua
23 changes: 15 additions & 8 deletions Kui_Stanzilla/kui.los-fade.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
local addon = KuiNameplates
local core = KuiNameplatesCore

local mod = addon:NewPlugin('LOSFader',101,5)
local mod = addon:NewPlugin('LOSFader',101,4)
if not mod then return end

local FADE_TO = 0.1
Expand Down Expand Up @@ -60,7 +60,8 @@ local function uf_OnUpdate(self,elap)
uf_elapsed = 0

for k,f in addon:Frames() do
sizer_OnSizeChanged(_G[f:GetName()..'PositionHelper'])
-- force LOS updates on all frames
sizer_OnSizeChanged(f.LOSFade_Sizer)
end

uf_loop_world_entry = uf_loop_world_entry + 1
Expand All @@ -73,17 +74,22 @@ end

-- messages ####################################################################
function mod:Create(frame)
-- hook to frames' sizer
local sizer = _G[frame:GetName()..'PositionHelper']
if sizer then
sizer:HookScript('OnSizeChanged',sizer_OnSizeChanged)
end
-- create a frame to monitor when nameplates move
local sizer = CreateFrame('Frame',frame:GetName()..'LOSFadeSizer',frame)
sizer:SetPoint('BOTTOMLEFT',WorldFrame)
sizer:SetPoint('TOPRIGHT',frame,'CENTER')
sizer:SetScript('OnSizeChanged',sizer_OnSizeChanged)
sizer.f = frame
frame.LOSFade_Sizer = sizer
end

function mod:Show(frame)
uf:SetScript('OnUpdate',uf_OnUpdate)
end

function mod:LostTarget(frame)
-- target confuses us because it bumps the alpha up, so check again
sizer_OnSizeChanged(frame.LOSFade_Sizer)
end
-- events ######################################################################
function mod:PLAYER_ENTERING_WORLD()
uf:SetScript('OnUpdate',uf_OnUpdate)
Expand All @@ -94,6 +100,7 @@ function mod:OnEnable()
fading_FadeRulesReset()
self:RegisterMessage('Create')
self:RegisterMessage('Show')
self:RegisterMessage('LostTarget')
self:RegisterEvent('PLAYER_ENTERING_WORLD')
end

Expand Down

0 comments on commit e7246ba

Please sign in to comment.