Skip to content

Commit

Permalink
Toggle frame
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoRogai committed Sep 2, 2024
1 parent 23d36ee commit 23a00fa
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions RepHub.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local LibDataBroker = LibStub("LibDataBroker-1.1"):NewDataObject("RepHub", {
tooltip:AddLine("Click to show RepHub")
end,
OnClick = function()
RepHub:ShowRepHubFrame()
RepHub:ToggleRepHubFrame()
end,
})
local LibDBIcon = LibStub("LibDBIcon-1.0")
Expand Down Expand Up @@ -80,8 +80,7 @@ function RepHub:CreateRepHubFrame()
RepHubFrame:SetCallback(
"OnClose",
function(widget)
RepHubFrame.frame:Hide()
RepHubFrameShown = false
RepHub:HideRepHubFrame()
end
)

Expand Down Expand Up @@ -118,11 +117,19 @@ function RepHub:CreateRepHubFrame()
end

function RepHub:ShowRepHubFrame()
if RepHubFrameShown then
return
end

RepHubFrame.frame:Show()

RepHubFrameShown = true
end

function RepHub:HideRepHubFrame()
RepHubFrame.frame:Hide()
RepHubFrameShown = false
end

function RepHub:ToggleRepHubFrame()
if not RepHubFrameShown then
RepHub:ShowRepHubFrame()
else
RepHub:HideRepHubFrame()
end
end

0 comments on commit 23a00fa

Please sign in to comment.