From d3ea1da9728465a2691b1e2d1f003b99c47971b5 Mon Sep 17 00:00:00 2001 From: Mark W Date: Wed, 13 Nov 2024 16:20:19 +0100 Subject: [PATCH] Slight optimization in situations where the skyriding talent UI is opened before the spellbook/talent UI --- modules/copyTalentButtonInfo.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/copyTalentButtonInfo.lua b/modules/copyTalentButtonInfo.lua index e25e551..f55f439 100644 --- a/modules/copyTalentButtonInfo.lua +++ b/modules/copyTalentButtonInfo.lua @@ -19,7 +19,7 @@ end function Module:OnEnable() Util:OnTalentUILoad(function() - self:SetupHook(Util:GetTalentFrame()); + self:SetupHook(Util:GetTalentFrame(), true); end); Util:ContinueOnAddonLoaded('Blizzard_GenericTraitUI', function() self:SetupHook(GenericTraitFrame); @@ -58,14 +58,16 @@ function Module:GetName() return L['Copy SpellID on hover']; end -function Module:SetupHook(talentsTab) +function Module:SetupHook(talentsTab, isPlayerSpellsUI) talentsTab:RegisterCallback(TalentFrameBaseMixin.Event.TalentButtonAcquired, self.OnTalentButtonAcquired, self); for talentButton in talentsTab:EnumerateAllTalentButtons() do self:OnTalentButtonAcquired(talentButton); end self:SecureHook(talentsTab, 'ShowSelections', 'OnShowSelections'); - EventRegistry:RegisterCallback("PlayerSpellsFrame.SpellBookFrame.DisplayedSpellsChanged", self.OnSpellbookUpdate, self); - self:OnSpellbookUpdate(); + if isPlayerSpellsUI then + EventRegistry:RegisterCallback("PlayerSpellsFrame.SpellBookFrame.DisplayedSpellsChanged", self.OnSpellbookUpdate, self); + self:OnSpellbookUpdate(); + end end function Module:EnableBinding()