From 53fb1cfa2f5da76c2a0f28508330f6d86b4c3f26 Mon Sep 17 00:00:00 2001 From: shagu Date: Fri, 19 Jul 2019 18:08:20 +0200 Subject: [PATCH] unitframes: check for disabled in visibility function --- api/unitframes.lua | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/api/unitframes.lua b/api/unitframes.lua index 39b6115f..20dfd494 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -182,7 +182,16 @@ function pfUI.uf:UpdateVisibility() local self = self or this if InCombatLockdown and InCombatLockdown() then return end - if self.config.visible == "0" then return end + + if self.config.visible == "0" then + if UnregisterStateDriver then + UnregisterStateDriver(self, "visibility") + self.visible = nil + end + + self:Hide() + return + end if InCombatLockdown and not InCombatLockdown() then if pfUI.unlock and pfUI.unlock:IsShown() then @@ -195,8 +204,6 @@ function pfUI.uf:UpdateVisibility() self.visible = true end return - elseif InCombatLockdown and InCombatLockdown() then - return end local unitstr = string.format("%s%s", self.label or "", self.id or "") @@ -1171,11 +1178,6 @@ function pfUI.uf:RefreshUnit(unit, component) if not unit.id then unit.id = "" end local component = component or "" - if unit.config.visible ~= "1" then - unit:Hide() - return - end - -- don't update scanner activity if unit.label == "target" or unit.label == "targettarget" then if pfScanActive == true then return end @@ -1203,21 +1205,20 @@ function pfUI.uf:RefreshUnit(unit, component) end end - local unitstr = unit.label..unit.id + -- hide unused and invalid frames + unit:UpdateVisibility() + -- return on invisible unit frames + if not unit:IsShown() then return end + + -- create required fields + if not unit.cache then unit.cache = {} end + local unitstr = unit.label..unit.id local default_border = C.appearance.border.default if C.appearance.border.unitframes ~= "-1" then default_border = C.appearance.border.unitframes end - -- create required fields - if not unit.cache then unit.cache = {} end - - -- hide unused and invalid frames - unit:UpdateVisibility() - - if not unit:IsShown() then return end - -- Buffs if unit.buffs and ( component == "all" or component == "aura" ) then for i=1, unit.config.bufflimit do