Skip to content

Commit

Permalink
Add Instant Cast and Lock Action Bars.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkthnx committed Nov 13, 2024
1 parent d4724ab commit e6ea247
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions KkthnxUI/Config/GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ local ActionBar = function(self)
Window:CreateSwitch("ActionBar", "Grid", "Actionbar Grid", nil, UpdateActionbarHotkeys)
Window:CreateSwitch("ActionBar", "Hotkeys", L["Enable Hotkey"], nil, UpdateActionbarHotkeys)
Window:CreateSwitch("ActionBar", "Macro", L["Enable Macro"], nil, UpdateActionbarHotkeys)
Window:CreateSwitch("ActionBar", "KeyDown", newFeatureIcon .. "Cast on Key Press", "Cast spells and abilities on key press, not key release", UpdateActionbarHotkeys)
Window:CreateSwitch("ActionBar", "ButtonLock", newFeatureIcon .. "Lock Action Bars", "Keep your action bar layout locked in place to prevent accidental reordering. To move a spell or ability while locked, hold the Shift key.", UpdateActionbarHotkeys)
Window:CreateSwitch("ActionBar", "Cooldown", L["Show Cooldowns"])
Window:CreateSwitch("ActionBar", "MicroMenu", L["Enable MicroBar"])
Window:CreateSwitch("ActionBar", "FadeMicroMenu", L["Mouseover MicroBar"])
Expand Down
2 changes: 2 additions & 0 deletions KkthnxUI/Config/Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ C["ActionBar"] = {
FadeMicroMenu = false,
ShowStance = true,
EquipColor = false,
KeyDown = true,
ButtonLock = true,
VehButtonSize = 34,

Bar1 = true,
Expand Down
7 changes: 4 additions & 3 deletions KkthnxUI/Modules/ActionBars/Elements/Bars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function Module:UpdateButtonConfig(i)
}
end

self.buttonConfig.clickOnDown = true
self.buttonConfig.clickOnDown = GetCVarBool("ActionButtonUseKeyDown")
self.buttonConfig.showGrid = C["ActionBar"]["Grid"]
self.buttonConfig.flyoutDirection = directions[C["ActionBar"]["Bar" .. i .. "Flyout"]]

Expand Down Expand Up @@ -208,13 +208,12 @@ function Module:UpdateButtonConfig(i)
hideElements.equipped = not C["ActionBar"]["EquipColor"]

-- Update button attributes and configuration based on CVAR values and button config
local lockBars = GetCVar("lockActionBars") == "1"
local lockBars = C["ActionBar"]["ButtonLock"]
for _, button in next, self.buttons do
self.buttonConfig.keyBoundTarget = button.bindName
button.keyBoundTarget = self.buttonConfig.keyBoundTarget

button:SetAttribute("buttonlock", lockBars)
button:SetAttribute("unlockedpreventdrag", not lockBars)
button:SetAttribute("checkmouseovercast", true)
button:SetAttribute("checkfocuscast", true)
button:SetAttribute("checkselfcast", true)
Expand Down Expand Up @@ -245,6 +244,8 @@ function Module:UpdateBarVisibility()
end

function Module:UpdateBarConfig()
SetCVar("ActionButtonUseKeyDown", C["ActionBar"]["KeyDown"] and 1 or 0)

for i = 1, 8 do
local frame = _G["KKUI_ActionBar" .. i]
if frame then
Expand Down

0 comments on commit e6ea247

Please sign in to comment.