Skip to content

Commit

Permalink
add toggle for click casting
Browse files Browse the repository at this point in the history
  • Loading branch information
Krealle committed Sep 2, 2024
1 parent 7b0a921 commit 2b28dc7
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions UnitFrames/MenuOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ local function AddLoadPageDB(unitPage)
unitPage.hideBlizzardCastBarCB:SetChecked(pageDB.hideBlizzardCastBar)
end

-- click casting
unitPage.clickCastCB:SetChecked(pageDB.clickCast)

if isPlayerPage then
unitPage.widthSlider:SetEnabled(true)
unitPage.heightSlider:SetEnabled(true)
Expand Down Expand Up @@ -100,10 +103,11 @@ local function AddUnitsToMenu()
unitPage.pageButton = CUF:CreateButton(parent.unitSection, L[unit], { 85, 17 })
unitPage.pageButton.id = unit ---@type Unit

-- First row

---@type CheckButton
unitPage.enabledCB = Cell:CreateCheckButton(unitPage.frame,
L["Enable"] .. " " .. L[unit] .. " " .. L
.Frame,
L["Enable"],
function(checked)
CUF.DB.SelectedLayoutTable()[unit].enabled = checked
if CUF.vars.selectedLayout == CUF.DB.GetMasterLayout() then
Expand All @@ -113,6 +117,13 @@ local function AddUnitsToMenu()
end)
unitPage.enabledCB:SetPoint("TOPLEFT", 5, -10)

unitPage.clickCastCB = Cell:CreateCheckButton(unitPage.frame, L["Click Casting"],
function(checked)
CUF.DB.SelectedLayoutTable()[unit].clickCast = checked
CUF:Fire("UpdateClickCasting", false, false, unit)
end)
unitPage.clickCastCB:SetPoint("TOPLEFT", unitPage.enabledCB, "TOPRIGHT", 70, 0)

if unit ~= CUF.constants.UNIT.PLAYER then
-- same size as player
---@type CheckButton?
Expand All @@ -131,17 +142,19 @@ local function AddUnitsToMenu()
CUF:Fire("UpdateLayout", CUF.vars.selectedLayout, unit .. "-power")
end
end)
unitPage.sameSizeAsPlayerCB:SetPoint("TOPLEFT", unitPage.enabledCB, "TOPRIGHT", 200, 0)
unitPage.sameSizeAsPlayerCB:SetPoint("TOPLEFT", unitPage.clickCastCB, "TOPRIGHT", 130, 0)
else
-- Disable blizzard cast bar
unitPage.hideBlizzardCastBarCB = Cell:CreateCheckButton(unitPage.frame, L.HideDefaultCastBar,
function(checked)
CUF.DB.SelectedLayoutTable()[unit].hideBlizzardCastBar = checked
CUF:Fire("UpdateVisibility", unit)
end, L.HideDefaultCastBarTooltip)
unitPage.hideBlizzardCastBarCB:SetPoint("TOPLEFT", unitPage.enabledCB, "TOPRIGHT", 200, 0)
unitPage.hideBlizzardCastBarCB:SetPoint("TOPLEFT", unitPage.clickCastCB, "TOPRIGHT", 130, 0)
end

-- Second row

---@type CellSlider
unitPage.widthSlider = Cell:CreateSlider(L["Width"], unitPage.frame, 20, 500, 117, 1, function(value)
CUF.DB.SelectedLayoutTable()[unit].size[1] = value
Expand Down Expand Up @@ -174,6 +187,8 @@ local function AddUnitsToMenu()
CUF:SetTooltips(unitPage.copyFromDropdown, "ANCHOR_TOPLEFT", 0, 3, L.CopyWidgetsFrom,
L.CopyWidgetsFromTooltip)

-- Third row

---@type CellSlider
unitPage.heightSlider = Cell:CreateSlider(L["Height"], unitPage.frame, 20, 500, 117, 1, function(value)
CUF.DB.SelectedLayoutTable()[unit].size[2] = value
Expand Down

0 comments on commit 2b28dc7

Please sign in to comment.