mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Make [button:N] mean the invoking button, as retail does
[button:N] was a held-state modifier: IsMouseButtonDown(name), true while you
physically hold that button. Retail's is a property of the activation -- which
button clicked the action button -- and a keybind press counts as button 1
because it activates through the left-click path. Different in kind, and the
visible break was [button:1] Rejuvenation; Regrowth casting Regrowth from a
keybind, where retail casts Rejuvenation.
It now reads ClassicAPI's GetMouseButtonClicked, defaulting to LeftButton when
no click dispatch is running. That default IS the keybind rule: Button:Click()
with no argument reports LeftButton, and a macro run from anywhere else answers
button 1 the same way.
This also reverts 891467c. That commit refreshed the action bar on
GLOBAL_MOUSE_DOWN/UP so the icon could track the held state -- under the real
semantics there is no such state to track, and the icon correctly sits on
whatever button 1 resolves to. PLAYER_TOTEM_UPDATE stays; it shared the comment
and inherits it.
Requires ClassicAPI v1.15.8, up from v1.15.0. v1.15.8 scoped
GetMouseButtonClicked to the click dispatch; before it a HELD button kept the
value alive (by design -- OnDragStart reads it), so turning the camera with
right-click down made every keybind press read RightButton. The function exists
below v1.15.8 and answers wrongly, and a conditional that is quietly wrong is
worse than one that warns, so the floor moved rather than the conditional being
gated.
Bare [button] / [nobutton] survive as an extension retail has no equivalent for,
now meaning "a click dispatch is running" -- the practical "activated by a
keybind, not a click" test, and no longer leaning on anything but the documented
nil.
This commit is contained in:
+18
-8
@@ -734,14 +734,24 @@ CleveRoids.buttons = {
|
||||
['5'] = 'Button5',
|
||||
}
|
||||
|
||||
-- True while any mapped mouse button is held. Backs the argument-less [button] /
|
||||
-- [nobutton], mirroring how a bare [mod] means "any modifier". Bare [nobutton] is
|
||||
-- the practical "activated by a keybind, not a click" test.
|
||||
function CleveRoids.AnyMouseButtonDown()
|
||||
for _, name in pairs(CleveRoids.buttons) do
|
||||
if IsMouseButtonDown(name) then return true end
|
||||
end
|
||||
return false
|
||||
-- The button that invoked the action now running, as retail's [button:N] means
|
||||
-- it. ClassicAPI v1.15.8+ scopes GetMouseButtonClicked to the click dispatch, so
|
||||
-- it reads the button of the handler this macro is running under -- through the
|
||||
-- helpers the handler calls, not just the handler itself -- and nil at any other
|
||||
-- time. A held button no longer keeps it set, which is what made mouse-turning
|
||||
-- poison every keybind press before v1.15.8.
|
||||
--
|
||||
-- nil outside a click dispatch, so the tooltip resolves as button 1 and sits
|
||||
-- still rather than tracking the mouse. Button:Click() with no argument reports
|
||||
-- LeftButton, which is how a keybind comes out as button 1 on retail.
|
||||
function CleveRoids.GetActivatingButton()
|
||||
return GetMouseButtonClicked() or "LeftButton"
|
||||
end
|
||||
|
||||
-- True while a click dispatch is what is running this action. Backs bare
|
||||
-- [button] / [nobutton], which retail has no equivalent for.
|
||||
function CleveRoids.WasClickActivated()
|
||||
return GetMouseButtonClicked() ~= nil
|
||||
end
|
||||
|
||||
CleveRoids.kmods = {
|
||||
|
||||
Reference in New Issue
Block a user