forked from TekNoLogic/Cork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMousewheel.lua
28 lines (21 loc) · 885 Bytes
/
Mousewheel.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
local myname, Cork = ...
-- Dynamic mousewheel binding module, originally created by Adirelle <[email protected]>
local function ClearBindings()
if InCombatLockdown() then return end
ClearOverrideBindings(CorkFrame)
end
function Cork:UpdateMouseBinding(event, unit)
if InCombatLockdown() then return end
if Cork.db.bindwheel and (event ~= "PLAYER_REGEN_DISABLED") and Corkboard:IsVisible() then
SetOverrideBindingClick(CorkFrame, true, 'MOUSEWHEELUP', 'CorkFrame')
SetOverrideBindingClick(CorkFrame, true, 'MOUSEWHEELDOWN', 'CorkFrame')
else
ClearOverrideBindings(CorkFrame)
end
end
local frame = CreateFrame('Frame', nil, Corkboard)
frame:SetScript('OnShow', Cork.UpdateMouseBinding)
frame:SetScript('OnHide', ClearBindings)
frame:SetScript("OnEvent", Cork.UpdateMouseBinding)
frame:RegisterEvent('PLAYER_REGEN_ENABLED')
frame:RegisterEvent('PLAYER_REGEN_DISABLED')