You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 21, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: Objects/ACTIONBUTTON_DragAndDrop.lua
+18-14Lines changed: 18 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -10,8 +10,6 @@
10
10
localACTIONBUTTON=Neuron.ACTIONBUTTON
11
11
12
12
localmacroDrag= {} --this is a table that holds onto the contents of the current macro being dragged
13
-
Neuron.macroDrag=macroDrag--class level handle for checking during show/hide states
14
-
15
13
localmacroCache= {} --this will hold onto any previous contents of our button
16
14
17
15
--------------------------------------
@@ -23,19 +21,21 @@ function ACTIONBUTTON:OnDragStart()
23
21
return
24
22
end
25
23
26
-
self.drag=nil--flag that says if it's ok to drag or not
24
+
Neuron.dragging=true
25
+
26
+
localdrag=nil--flag that says if it's ok to drag or not
27
27
28
28
ifnotself.barLockthen
29
-
self.drag=true
29
+
drag=true
30
30
elseifself.barLockAltandIsAltKeyDown() then
31
-
self.drag=true
31
+
drag=true
32
32
elseifself.barLockCtrlandIsControlKeyDown() then
33
-
self.drag=true
33
+
drag=true
34
34
elseifself.barLockShiftandIsShiftKeyDown() then
35
-
self.drag=true
35
+
drag=true
36
36
end
37
37
38
-
ifself.dragthen
38
+
ifdragthen
39
39
40
40
ClearCursor()
41
41
@@ -75,7 +75,7 @@ function ACTIONBUTTON:OnReceiveDrag()
75
75
wipe(macroCache)
76
76
end
77
77
78
-
ifmacroDrag[1]then--checks to see if the thing we are placing is a Neuron created macro vs something from the spellbook
78
+
if#macroDrag>0then--checks to see if the thing we are placing is a Neuron created macro vs something from the spellbook
79
79
self:PlaceMacro()
80
80
elseifcursorType=="spell" then
81
81
self:PlaceSpell(action1, action2, spellID)
@@ -107,14 +107,14 @@ function ACTIONBUTTON:OnReceiveDrag()
107
107
108
108
self:SetType()
109
109
self:UpdateAll()
110
-
self:UpdateCooldown() --clear any cooldowns that may be on the button now that the button is empty
111
110
112
-
ifmacroCache[1]then
111
+
if#macroCache>0then
113
112
self:OnDragStart(macroCache) --If we picked up a new ability after dropping this one we have to manually call OnDragStart
114
113
self:ACTIONBAR_SHOWGRID() --show the button grid if we have something picked up (i.e if macroDrag contains something)
115
114
else
116
115
SetCursor(nil)
117
116
ClearCursor() --if we did not pick up a new spell, clear the cursor
117
+
Neuron.dragging=false
118
118
end
119
119
120
120
ifNeuronObjectEditorandNeuronObjectEditor:IsVisible() then
@@ -124,20 +124,25 @@ end
124
124
125
125
126
126
functionACTIONBUTTON:PostClick() --this is necessary because if you are daisy-chain dragging spells to the bar you wont be able to place the last one due to it not firing an OnReceiveDrag
127
-
ifmacroDrag[1]then
127
+
if#macroDrag>0then
128
128
self:OnReceiveDrag()
129
129
end
130
130
self:UpdateStatus()
131
131
end
132
132
133
133
--we need to hook to the WorldFrame OnReceiveDrag and OnMouseDown so that we can "let go" of the spell when we drag it off the bar
134
134
functionACTIONBUTTON:WorldFrame_OnReceiveDrag()
135
-
ifmacroDrag[1]then--only do something if there's currently data in macroDrag. Otherwise it is just for normal Blizzard behavior
135
+
if#macroDrag>0then--only do something if there's currently data in macroDrag. Otherwise it is just for normal Blizzard behavior
136
136
SetCursor(nil)
137
137
ClearCursor()
138
+
Neuron.dragging=false
138
139
wipe(macroDrag)
139
140
wipe(macroCache)
140
141
end
142
+
143
+
for_,vinpairs(Neuron.BARIndex) do
144
+
v:UpdateBarObjectVisibility()
145
+
end
141
146
end
142
147
--------------------------------------
143
148
--------------------------------------
@@ -202,7 +207,6 @@ function ACTIONBUTTON:PlaceMacro()
0 commit comments