Skip to content

Commit

Permalink
Slight optimization in situations where the skyriding talent UI is op…
Browse files Browse the repository at this point in the history
…ened before the spellbook/talent UI
  • Loading branch information
Numynum committed Nov 13, 2024
1 parent 401eba0 commit d3ea1da
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions modules/copyTalentButtonInfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit d3ea1da

Please sign in to comment.