Skip to content

Commit

Permalink
Fix dangling blue cursor when targeting dead units
Browse files Browse the repository at this point in the history
  • Loading branch information
Snakybo committed Sep 13, 2020
1 parent d767843 commit fc55192
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Core/BindingProcessor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ local function GetMacroForBindings(bindings)
end
end

-- add a segment to remove the blue casting cursor
table.insert(result, "/click " .. Clicked.STOP_CASTING_BUTTON_NAME)

-- Now sort the actions according to the above schema

table.sort(actions, SortActions)
Expand Down
8 changes: 8 additions & 0 deletions Core/CommandProcessor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ Clicked.COMMAND_ACTION_TARGET = "target"
Clicked.COMMAND_ACTION_MENU = "menu"
Clicked.COMMAND_ACTION_MACRO = "macro"

Clicked.STOP_CASTING_BUTTON_NAME = "ClickedStopCastingButton"

local macroFrameHandlers = {}
local stopCastingButton

local function GetCommandAttributeIdentifier(command, isClickCastCommand)
-- separate modifiers from the actual binding
Expand Down Expand Up @@ -110,6 +113,11 @@ function Clicked:ProcessCommands(commands)
local newClickCastFrameAttributes = {}
local nextMacroFrameHandler = 1

if stopCastingButton == nil then
stopCastingButton = CreateFrame("Button", self.STOP_CASTING_BUTTON_NAME, nil, "SecureActionButtonTemplate")
stopCastingButton:SetAttribute("type", "stop")
end

for _, command in ipairs(commands) do
local isHoverCastBinding = command.mode == self.TARGETING_MODE_HOVERCAST
local prefix, suffix, isMouseButton = GetCommandAttributeIdentifier(command, isHoverCastBinding)
Expand Down

0 comments on commit fc55192

Please sign in to comment.