Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuller committed Jan 19, 2024
1 parent e05f83c commit 9c9f45b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
32 changes: 7 additions & 25 deletions Dominos/bars/actionBar/buttons.classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ ActionButtons.ShowGridReasons = {
-- [button] = id
ActionButtons.buttons = {}

-- [reason] = show
ActionButtons.showGridStates = {}

-- dirty secure attributes
ActionButtons.dirtyAttributes = {}

Expand Down Expand Up @@ -62,15 +59,15 @@ function ActionButtons:CVAR_UPDATE(name)
end

function ActionButtons:LIBKEYBOUND_ENABLED()
self:SetShowGrid(SHOW_GRID_REASONS.KEYBOUND_EVENT, true)
self:SetShowGrid(self.ShowGridReasons.KEYBOUND_EVENT, true)
end

function ActionButtons:LIBKEYBOUND_DISABLED()
self:SetShowGrid(SHOW_GRID_REASONS.KEYBOUND_EVENT, false)
self:SetShowGrid(self.ShowGridReasons.KEYBOUND_EVENT, false)
end

function ActionButtons:SHOW_EMPTY_BUTTONS_CHANGED(_, show)
self:SetShowGrid(SHOW_GRID_REASONS.ADDON_SHOW_EMPTY_BUTTONS, show)
self:SetShowGrid(self.ShowGridReasons.SHOW_EMPTY_BUTTONS, show)
end

-- api
Expand Down Expand Up @@ -124,7 +121,6 @@ function ActionButtons:GetOrCreateActionButton(id, parent)
Mixin(button, Addon.ActionButton)
button:OnCreate(id)
self:WrapScript(button, "OnClick", ActionButton_ClickBefore)
self:LoadShowGrid(button)

self.buttons[button] = id
-- a standard UI button we're reusing
Expand All @@ -140,7 +136,6 @@ function ActionButtons:GetOrCreateActionButton(id, parent)
button:OnCreate(id)

self:WrapScript(button, "OnClick", ActionButton_ClickBefore)
self:LoadShowGrid(button)

self.buttons[button] = id
end
Expand All @@ -149,28 +144,11 @@ function ActionButtons:GetOrCreateActionButton(id, parent)
end

function ActionButtons:Initialize()
-- load show grid states
self.showGridStates[SHOW_GRID_REASONS.ADDON_SHOW_EMPTY_BUTTONS] = Addon:ShowGrid()

local keybound = LibStub("LibKeyBound-1.0", true)
if keybound then
self.showGridStates[SHOW_GRID_REASONS.KEYBOUND_EVENT] = keybound:IsShown()
end

self:SetAttribute("lockActionBars", GetCVarBool("lockActionBars"))
self:SetAttribute("ActionButtonUseKeyDown", GetCVarBool("ActionButtonUseKeyDown"))
end

function ActionButtons:LoadShowGrid(button)
local states = self.showGridStates

for _, reason in pairs(SHOW_GRID_REASONS) do
button:SetShowGrid(reason, states[reason] and true)
end
end

function ActionButtons:SetShowGrid(reason, show)
self.showGridStates[reason] = show and true or nil
self:ForAll("SetShowGrid", reason, show)
end

Expand All @@ -196,5 +174,9 @@ function ActionButtons:ForAll(method, ...)
end
end

function ActionButtons:GetAll()
return pairs(self.buttons)
end

-- exports
Addon.ActionButtons = ActionButtons
2 changes: 1 addition & 1 deletion Dominos/bars/actionBar/buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ function ActionButtons:LIBKEYBOUND_DISABLED()
end

function ActionButtons:SHOW_EMPTY_BUTTONS_CHANGED(_, show)
self:SetShowGrid(self.ShowGridReasons.ADDON_SHOW_EMPTY_BUTTONS, show)
self:SetShowGrid(self.ShowGridReasons.SHOW_EMPTY_BUTTONS, show)
end

function ActionButtons:OnActionChanged(buttonName, action, prevAction)
Expand Down

0 comments on commit 9c9f45b

Please sign in to comment.