Skip to content

Commit

Permalink
- Tooltips only display if they have text.
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Feb 1, 2024
1 parent 86833fd commit 9b491f0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions init.lua
Expand Up @@ -384,14 +384,19 @@ end
local function DrawButtonTooltip(Button, label)
-- hover tooltip
if Button.Unassigned == nil and ImGui.IsItemHovered() then
ImGui.BeginTooltip()
local countDown, _ = GetButtonCooldown(Button)
local tooltipText = label
if countDown ~= 0 then
tooltipText = tooltipText .. "\n\n" .. btnUtils.FormatTime(math.ceil(countDown))

-- check label instead of tooltipText because if there is no text we dont care about the timer.
if label:len() > 0 then
local countDown, _ = GetButtonCooldown(Button)
if countDown ~= 0 then
tooltipText = tooltipText .. "\n\n" .. btnUtils.FormatTime(math.ceil(countDown))
end

ImGui.BeginTooltip()
ImGui.Text(tooltipText)
ImGui.EndTooltip()
end
ImGui.Text(tooltipText)
ImGui.EndTooltip()
end
end

Expand Down

0 comments on commit 9b491f0

Please sign in to comment.