git
/
wowui.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5d20ef0
)
0973648 - Change update CD throttling to not always update twice
author
Aleksi Blinnikka <aleksi.blinnikka@gmail.com>
Fri, 23 Feb 2018 15:10:51 +0000
committer
Aleksi Blinnikka <aleksi.blinnikka@gmail.com>
Fri, 23 Feb 2018 15:10:51 +0000
OmaAB/ActionBars.lua
patch
|
blob
|
history
diff --git
a/OmaAB/ActionBars.lua
b/OmaAB/ActionBars.lua
index
610dcf3
..
937d1d0
100644
(file)
--- a/
OmaAB/ActionBars.lua
+++ b/
OmaAB/ActionBars.lua
@@
-549,23
+549,33
@@
local function setupBindings()
end
local mounted = false;
end
local mounted = false;
-local throttleCD = false;
+-- throttleCD 3-state, nil -> false -> true -> nil
+-- this way there's not double update each time the first
+-- update event comes, instead the extra throttled update comes
+-- if there are >2 ACTIONBAR_UPDATE_COOLDOWN events in one frame
+local throttleCD = nil;
local function throttleCDDone()
local function throttleCDDone()
- throttleCD = false
-- update CD once more to confirm newest CD change is taken in even with some throttling
for _, button in pairs(activeButtons) do
updateCooldown(button, button.slot);
end
end
-- update CD once more to confirm newest CD change is taken in even with some throttling
for _, button in pairs(activeButtons) do
updateCooldown(button, button.slot);
end
end
+local function throttleCDReset()
+ throttleCD = nil;
+end
local events = {
["ACTIONBAR_UPDATE_COOLDOWN"] = function()
if not throttleCD then -- only update at most once/frame
local events = {
["ACTIONBAR_UPDATE_COOLDOWN"] = function()
if not throttleCD then -- only update at most once/frame
- throttleCD = true;
- for _, button in pairs(activeButtons) do
- updateCooldown(button, button.slot);
+ throttleCD = throttleCD == false and true or false;
+ if throttleCD then
+ CTimerAfter(0.01, throttleCDDone); -- wait one frame
+ else
+ for _, button in pairs(activeButtons) do
+ updateCooldown(button, button.slot);
+ end
+ CTimerAfter(0.01, throttleCDReset); -- wait one frame
end
end
- CTimerAfter(0.01, throttleCDDone); -- wait one frame
end
end,
["SPELL_UPDATE_CHARGES"] = function()
end
end,
["SPELL_UPDATE_CHARGES"] = function()