-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdoubleClick.lua
More file actions
102 lines (95 loc) · 4 KB
/
doubleClick.lua
File metadata and controls
102 lines (95 loc) · 4 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
local T = Angleur_Translate
local debugChannel = 6
local colorDebug = CreateColor(0.9, 0.47, 1) -- lily
angleurDoubleClick = {
watching = false,
heldDown = false,
ignoreNextMouseUp = false,
iDtoButtonName = {"title(aka useless)", "BUTTON2", "BUTTON1"},
iDtoLeftRight = {"title(aka useless)", "RightButton", "LeftButton"},
}
-- !!!! AS OF UNDERMINED, WORLD FRAME NO LONGER RECEIVES DRAG !!!!
-- function Angleur_RegisterAndHook()
-- if angleurDoubleClick.hookedregistered == true then return end
-- WorldFrame:RegisterForDrag("RightButton")
-- WorldFrame:HookScript("OnDragStart", function(self, button)
-- if IsMouseButtonDown("RightButton") then
-- MouselookStart()
-- end
-- end)
-- angleurDoubleClick.hookedregistered = true
-- end
function Angleur_StuckFix()
if AngleurConfig.chosenMethod ~= "doubleClick" then return end
if IsMouselooking() then
if IsMouseButtonDown("RightButton") then
else
MouselookStop()
Angleur_BetaPrint(debugChannel, colorDebug:WrapTextInColorCode("Angleur_StuckFix ") .. ": Double Click mouse look released")
end
end
end
function Angleur_DoubleClickWatcher(self, event, button)
if AngleurConfig.chosenMethod ~= "doubleClick" then return end
if AngleurCharacter.sleeping then return end
if button ~= angleurDoubleClick.iDtoLeftRight[AngleurConfig.doubleClickChosenID] then return end
--print("Mouseover UIParent: ", UIParent:IsMouseOver())
if not WorldFrame:IsMouseMotionFocus() and GetMouseFoci()[1] ~= nil then
if not AngleurClassicConfig.softInteract.enabled or not AngleurClassicConfig.softInteract.bobberScanner then
--print("Mouse on another frame, ignoring")
return
else
--needed for bobber Scanner double click fishing
end
end
if event == "GLOBAL_MOUSE_UP" then
Angleur_StuckFix()
if InCombatLockdown() then return end
if UnitIsDeadOrGhost("player") then return end
if angleurDoubleClick.ignoreNextMouseUp then angleurDoubleClick.ignoreNextMouseUp = false return end
if not angleurDoubleClick.watching then
angleurDoubleClick.watching = true
--print("double click watching")
Angleur_ActionHandler(Angleur)
Angleur_PoolDelayer(Angleur_TinyOptions.doubleClickWindow, 0, 0.05, angleurDelayers, nil, function()
angleurDoubleClick.watching = false
--print("no longer watching")
Angleur_ActionHandler(Angleur)
end)
else
angleurDoubleClick.watching = false
--print("Watch ended manually")
Angleur_ActionHandler(Angleur)
end
elseif event == "GLOBAL_MOUSE_DOWN" then
if angleurDoubleClick.watching == true then
if IsMouseButtonDown(angleurDoubleClick.iDtoLeftRight[AngleurConfig.doubleClickChosenID]) then
MouselookStart()
else
MouselookStop()
end
end
angleurDoubleClick.heldDown = true
Angleur_PoolDelayer(0.2, 0, 0.05, angleurDelayers, function()
if angleurDoubleClick.heldDown then
if not IsMouseButtonDown(angleurDoubleClick.iDtoLeftRight[AngleurConfig.doubleClickChosenID]) then
angleurDoubleClick.heldDown = false
else
--print("Still being held")
end
end
end,
function()
if angleurDoubleClick.heldDown then
--print("held too long, ignoring MOUSEUP")
angleurDoubleClick.ignoreNextMouseUp = true
end
end)
end
end
local doubleClickFrame = CreateFrame("Frame")
doubleClickFrame:RegisterEvent("GLOBAL_MOUSE_UP")
doubleClickFrame:RegisterEvent("GLOBAL_MOUSE_DOWN")
doubleClickFrame:RegisterEvent("PLAYER_STARTED_LOOKING")
doubleClickFrame:RegisterEvent("PLAYER_STOPPED_LOOKING")
doubleClickFrame:SetScript("OnEvent", Angleur_DoubleClickWatcher)