187bc84 - Invalidate button.prev when slot changes
authorAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Thu, 15 Mar 2018 09:12:01 +0000
committerAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Thu, 15 Mar 2018 09:12:01 +0000
OmaAB/ActionBars.lua

index e6637e9..706e33e 100644 (file)
@@ -6,6 +6,7 @@ local ssub = string.sub;
 local GetActionInfo, GetActionTexture = GetActionInfo, GetActionTexture;
 local GetActionLossOfControlCooldown = GetActionLossOfControlCooldown;
 local GetActionCooldown, GetActionCharges = GetActionCooldown, GetActionCharges;
+local GetActionText, GetBindingKey = GetActionText, GetBindingKey;
 local IsConsumableAction, IsStackableAction = IsConsumableAction, IsStackableAction;
 local IsItemAction, GetActionCount = IsItemAction, GetActionCount;
 local IsSpellOverlayed, GetMacroSpell = IsSpellOverlayed, GetMacroSpell;
@@ -15,7 +16,6 @@ local IsCurrentAction, IsAutoRepeatAction = IsCurrentAction, IsAutoRepeatAction;
 local CreateFrame = CreateFrame;
 local RegisterStateDriver = RegisterStateDriver;
 local CooldownFrame_Set, CooldownFrame_Clear = CooldownFrame_Set, CooldownFrame_Clear;
-local CTimerAfter = C_Timer.After;
 local GameTooltip = GameTooltip;
 local GameTooltip_SetDefaultAnchor = GameTooltip_SetDefaultAnchor;
 local COOLDOWN_TYPE_LOSS_OF_CONTROL = COOLDOWN_TYPE_LOSS_OF_CONTROL;
@@ -523,7 +523,10 @@ local function createActionBar(parent, config)
             secure:SetAttribute("flyoutDirection", config.flyout);
         end
         function secure:ActionChanged(oldslot)
-            if oldslot then activeButtons[oldslot] = nil end
+            if oldslot then
+                activeButtons[oldslot] = nil;
+                self.prev = nil; -- invalidate previous CD when slot changes
+            end
             self.slot = self:GetAttribute("action");
             return updateButton(self, self.slot);
         end
@@ -552,7 +555,7 @@ local function initialize()
 end
 
 local function setupBindings()
-    BINDING_HEADER_OmaAB = "Oma Action Bar";
+    _G["BINDING_HEADER_OmaAB"] = "Oma Action Bar";
     for i = 1,10 do
         _G["BINDING_HEADER_OMAABBLANK"..i] = "Bar "..i;
         for j = 1,12 do