From bf493645c18e1c416f4821cb74f4c20e83518e13 Mon Sep 17 00:00:00 2001 From: shagu Date: Mon, 16 Dec 2019 10:43:04 +0100 Subject: [PATCH] actionbar: only refresh required slot changes --- modules/actionbar.lua | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/modules/actionbar.lua b/modules/actionbar.lua index 0edd1cb0..eb1fda58 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -240,6 +240,13 @@ pfUI:RegisterModule("actionbar", "vanilla:tbc", function () end end + -- helper function to update by slot + local function RefreshSlot(slot) + local bar, button = ceil(slot/12), mod(slot, 12) + button = button == 0 and 12 or button + table.insert(updatecache, pfUI.bars[bar][button]) + end + local usable, oom, start, duration, enable, castable, autocast, token local id, bar, active, texture local function ButtonRefresh(self) @@ -573,6 +580,12 @@ pfUI:RegisterModule("actionbar", "vanilla:tbc", function () return end + -- refresh only specific slots + if event == "ACTIONBAR_SLOT_CHANGED" and arg1 and arg1 ~= 0 then + RefreshSlot(arg1) + return + end + -- handle global events for id, button in pairs(buttoncache) do ButtonRefresh(button) @@ -1043,13 +1056,6 @@ pfUI:RegisterModule("actionbar", "vanilla:tbc", function () pfUI.bars:UpdateConfig() - -- helper function to update by slot - local function RefreshSlot(slot) - local bar, button = ceil(slot/12), mod(slot, 12) - button = button == 0 and 12 or button - table.insert(updatecache, bars[bar][button]) - end - -- Localize custom keybinds for additional actionbars (see Bindings.xml) local names = { ["PAGING"] = T["Paging Actionbar"],