diff --git a/src/types/unitgroup.lua b/src/types/unitgroup.lua index c1fef22..d534451 100644 --- a/src/types/unitgroup.lua +++ b/src/types/unitgroup.lua @@ -32,9 +32,10 @@ local function RoleValue(role) end local function UnitFrameDefaultCompare(lhs, rhs) - -- visible < invisible - if lhs.secureFrame:IsShown() ~= rhs.secureFrame:IsShown() then - return lhs.secureFrame:IsShown() + -- exists < not exists + local lexists, rexists = UnitExists(lhs.unit), UnitExists(rhs.unit) + if lexists ~= rexists then + return lexists end local lunit, runit = lhs.unit, rhs.unit @@ -69,7 +70,6 @@ function UnitGroup:Init(left, top, width, height) self.top = top self.left = left self.units = {} - self.sortAfterCombat = false self:RegisterEvents() end @@ -104,18 +104,14 @@ function UnitGroup:PLAYER_REGEN_ENABLED() end function UnitGroup:OnLeaveCombat() - if self.sortAfterCombat then - self:Sort() - self.sortAfterCombat = false - end + self:Sort() end function UnitGroup:OnRosterUpdate() if InCombatLockdown() then - self.sortAfterCombat = true - else - self:Sort() + return end + self:Sort() end function UnitGroup:AddUnitFrame(unit)