mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-31 16:06:57 +00:00
Drive unit frame visibility from events
Every unit frame re-checked its visibility five times a second. Now group, target and pet events re-check it in OnEvent, which also runs while a frame is hidden, and the focus module already re-checks focus and focustarget on PLAYER_FOCUS_CHANGED. Only the frames with a tick keep the 0.2 second poll. They show another unit's target or a pet that can go out of sight, and no event reports either. The focus target frame now gets the same tick as targettarget, because no event reports the focus changing its target. Unlock mode and /pftest have no event, so they re-check every frame when they change. RegisterUnitWatch does not fit here. It polls on the same 0.2 second timer, and it only shows a unit that exists, without the pet range, raid grid and group hiding rules.
This commit is contained in:
+4
-3
@@ -8,7 +8,7 @@ pfUI:RegisterModule("focus", function ()
|
||||
UpdateMovable(pfUI.uf.focus)
|
||||
pfUI.uf.focus:Hide()
|
||||
|
||||
pfUI.uf.focustarget = pfUI.uf:CreateUnitFrame("FocusTarget", nil, C.unitframes.focustarget)
|
||||
pfUI.uf.focustarget = pfUI.uf:CreateUnitFrame("FocusTarget", nil, C.unitframes.focustarget, .2)
|
||||
pfUI.uf.focustarget:UpdateFrameSize()
|
||||
pfUI.uf.focustarget:SetPoint("BOTTOMLEFT", pfUI.uf.focus, "TOP", 0, 10)
|
||||
UpdateMovable(pfUI.uf.focustarget)
|
||||
@@ -16,8 +16,9 @@ pfUI:RegisterModule("focus", function ()
|
||||
|
||||
-- PLAYER_FOCUS_CHANGED drives immediate refresh on focus assign / clear.
|
||||
-- Between events, ClassicAPI fires UNIT_* (health/mana/aura/...) with
|
||||
-- arg1 == "focus" and arg1 == "focustarget", so both frames update
|
||||
-- event-driven like target and need no polling tick.
|
||||
-- arg1 == "focus" and arg1 == "focustarget", so the bars update
|
||||
-- event-driven like target. No event reports the focus changing its
|
||||
-- target, so focustarget ticks like targettarget.
|
||||
pfUI.events:RegisterFrameEventAndCallback("PLAYER_FOCUS_CHANGED", function()
|
||||
pfUI.uf.focus.instantRefresh = true
|
||||
pfUI.uf:RefreshUnit(pfUI.uf.focus, "all")
|
||||
|
||||
@@ -508,6 +508,10 @@ pfUI:RegisterModule("unlock", function ()
|
||||
UpdateMovable(frame)
|
||||
end
|
||||
|
||||
-- show the unit frames whose unit came and hide the ones whose unit went
|
||||
-- while unlocked
|
||||
pfUI.uf:UpdateAllVisibility()
|
||||
|
||||
SetDockToFrame(nil)
|
||||
pfUI.unlock:Hide()
|
||||
pfUI.gui:Show()
|
||||
|
||||
Reference in New Issue
Block a user