Skip to content

Commit

Permalink
flyout fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Daenarys committed Jun 29, 2024
1 parent 37c03fd commit bc206e1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
4 changes: 2 additions & 2 deletions RazerNaga/actionButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function ActionButtonMixin:OnCreate(id)
RazerNaga.BindableButton:AddQuickBindingSupport(self)

-- apply custom flyout
--RazerNaga.SpellFlyout:Register(self)
RazerNaga.SpellFlyout:Register(self)

-- use pre 10.x button size
self:SetSize(36, 36)
Expand Down Expand Up @@ -297,7 +297,7 @@ function ActionButton:AddCastOnKeyPressSupport(button)

bind.SetOverrideBindings = bindButton_SetOverrideBindings

--RazerNaga.SpellFlyout:Register(bind)
RazerNaga.SpellFlyout:Register(bind)

-- translate HOTKEY button "clicks" into LeftButton
self:WrapScript(bind, "OnClick", [[
Expand Down
44 changes: 25 additions & 19 deletions RazerNaga/spellFlyout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,35 +93,41 @@ function SpellFlyoutButtonMixin:UpdateCooldown()
end

function SpellFlyoutButtonMixin:UpdateState()
if C_Spell.IsCurrentSpell(self.spellID) then
self:SetChecked(true)
else
self:SetChecked(false)
if self.spellID then
if C_Spell.IsCurrentSpell(self.spellID) then
self:SetChecked(true)
else
self:SetChecked(false)
end
end
end

function SpellFlyoutButtonMixin:UpdateUsable()
local isUsable, notEnoughMana = C_Spell.IsSpellUsable(self.spellID)
local icon = self.icon
if ( isUsable ) then
icon:SetVertexColor(1.0, 1.0, 1.0)
elseif ( notEnoughMana ) then
icon:SetVertexColor(0.5, 0.5, 1.0)
else
icon:SetVertexColor(0.4, 0.4, 0.4)
if self.spellID then
local isUsable, notEnoughMana = C_Spell.IsSpellUsable(self.spellID)
local icon = self.icon
if ( isUsable ) then
icon:SetVertexColor(1.0, 1.0, 1.0)
elseif ( notEnoughMana ) then
icon:SetVertexColor(0.5, 0.5, 1.0)
else
icon:SetVertexColor(0.4, 0.4, 0.4)
end
end
end

function SpellFlyoutButtonMixin:UpdateCount()
if IsConsumableSpell(self.spellID) then
local count = C_Spell.GetSpellCastCount(self.spellID)
if count > (self.maxDisplayCount or 9999) then
self.Count:SetText("*")
if self.spellID then
if IsConsumableSpell(self.spellID) then
local count = C_Spell.GetSpellCastCount(self.spellID)
if count > (self.maxDisplayCount or 9999) then
self.Count:SetText("*")
else
self.Count:SetText(count)
end
else
self.Count:SetText(count)
self.Count:SetText("")
end
else
self.Count:SetText("")
end
end

Expand Down

0 comments on commit bc206e1

Please sign in to comment.