From 76aee2ba96d8d256280a93082f987daf1a6f0f5b Mon Sep 17 00:00:00 2001 From: muleyo Date: Tue, 13 Dec 2022 10:24:28 +0100 Subject: [PATCH] Fixed an issue which made the frames break when SortGroup or similar AddOns were active --- Core.lua | 32 +++++++++++++------------------- PartyRaidFrameResize.toc | 2 +- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Core.lua b/Core.lua index 7dbbcc3..0af6cef 100644 --- a/Core.lua +++ b/Core.lua @@ -1,27 +1,21 @@ PFR_Core = PFR:NewModule("PFR_Core") function PFR_Core:OnEnable() - function PFR:Update() - for i = 1, 5 do - _G["CompactPartyFrameMember" .. i]:SetWidth(PFR_DB.width) - _G["CompactPartyFrameMember" .. i]:SetHeight(PFR_DB.height) - _G["CompactPartyFrameMember" .. i .. "StatusText"]:ClearAllPoints() - _G["CompactPartyFrameMember" .. i .. "StatusText"]:SetPoint("CENTER", _G["CompactPartyFrameMember" .. i], "CENTER") - _G["CompactPartyFrameMember" .. i .. "CenterStatusIcon"]:ClearAllPoints() - _G["CompactPartyFrameMember" .. i .. "CenterStatusIcon"]:SetPoint("CENTER", _G["CompactPartyFrameMember" .. i], "CENTER") + function PFR:Update(self) + if self:IsForbidden() then return end + local name = self:GetName() + + if name and name:match("CompactPartyFrame") then + self:SetWidth(PFR_DB.width) + self:SetHeight(PFR_DB.height) + self.statusText:ClearAllPoints() + self.statusText:SetPoint("CENTER", self, "CENTER") + self.centerStatusIcon:ClearAllPoints() + self.centerStatusIcon:SetPoint("CENTER", self, "CENTER") end end - -- Register Events - PFR:RegisterEvent("ADDON_LOADED", "Update") - PFR:RegisterEvent("PLAYER_LOGIN", "Update") - PFR:RegisterEvent("VARIABLES_LOADED", "Update") - PFR:RegisterEvent("PLAYER_ENTERING_WORLD", "Update") - PFR:RegisterEvent("GROUP_ROSTER_UPDATE", "Update") - PFR:RegisterEvent("COMPACT_UNIT_FRAME_PROFILES_LOADED", "Update") - - -- Call function on exiting EditMode - hooksecurefunc(C_EditMode, "OnEditModeExit", function() - PFR:Update() + hooksecurefunc("CompactUnitFrame_UpdateAll", function(self) + PFR:Update(self) end) end \ No newline at end of file diff --git a/PartyRaidFrameResize.toc b/PartyRaidFrameResize.toc index 654cfb1..d104b7d 100644 --- a/PartyRaidFrameResize.toc +++ b/PartyRaidFrameResize.toc @@ -1,6 +1,6 @@ ## Interface: 100002 ## Author: muleyo -## Version: 1.0.1 +## Version: 1.0.2 ## Title: |cff009cffParty RaidFrame Resize|r ## Notes: Allows the user to resize the Party Raidframe and exceed the width/height slider limits ## SavedVariables: PFRDB