Skip to content

Commit

Permalink
Buttons: show buttons when changing drag radius (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
dixon committed May 3, 2023
1 parent 0e2ead0 commit e09d1b7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ do
end
end

local OnEnter = function()
function mod:ShowAllButtons()
if not mod.db.controlVisibility or fadeStop or moving then return end

for i = 1, #animFrames do
Expand All @@ -380,7 +380,8 @@ do
end
end
end
local OnLeave = function()

function mod:HideAllButtons()
if not mod.db.controlVisibility or moving then return end
local focus = GetMouseFocus() -- Minimap or Minimap icons including nil checks to compensate for other addons
if focus and not focus:IsForbidden() and ((focus:GetName() == "Minimap") or (focus:GetParent() and focus:GetParent():GetName() and focus:GetParent():GetName():find("Mini[Mm]ap"))) then
Expand All @@ -403,6 +404,14 @@ do
end
end

local OnEnter = function()
mod:ShowAllButtons()
end

local OnLeave = function()
mod:HideAllButtons()
end

local hideFrame = CreateFrame("Frame") -- Dummy frame we use for hiding buttons to prevent other addons re-showing them
hideFrame:Hide()
-- XXX hopefuly temporary workaround for line 376 of Minimap.lua
Expand Down Expand Up @@ -597,6 +606,8 @@ do
function mod:UpdateDraggables(frame)
if not mod.db.allowDragging then return end

mod:ShowAllButtons()

if frame then
local x, y = frame:GetCenter()
local name = namesCompatForDF[frame] or frame:GetName()
Expand All @@ -618,6 +629,9 @@ do
end
end
end

mod:HideAllButtons()

end
end

Expand Down

0 comments on commit e09d1b7

Please sign in to comment.