Keys now animate health like mouse buttons

This commit is contained in:
OldManAlpha 2025-08-09 23:20:17 -07:00
parent 9197288c21
commit 264544ebc4
6 changed files with 30 additions and 5 deletions

View File

@ -1279,6 +1279,12 @@ function PTUnitFrame:Initialize()
end
PT.Mouseover = nil
PT.MouseoverFrame = nil
if PT.CurrentlyHeldButton and not util.GetAllButtonsSet()[PT.CurrentlyHeldButton] then
self.pressed = false
self:AdjustHealthPosition()
PT.CurrentlyHeldButton = nil
PT.ReapplySpellsTooltip()
end
PT.RemoveOverrideBindings()
end)
button:EnableMouse(true)

View File

@ -460,6 +460,13 @@ function IsFrameHidden(frameName)
return PTOptions.FrameOptions[frameName] and PTOptions.FrameOptions[frameName].Hidden
end
function SetFrameHidden(frameName, hidden)
if not PTOptions.FrameOptions[frameName] then
PTOptions.FrameOptions[frameName] = {}
end
PTOptions.FrameOptions[frameName].Hidden = hidden
end
function IsFrameLocked(frameName)
return PTOptions.FrameOptions[frameName] and PTOptions.FrameOptions[frameName].Locked
end

View File

@ -33,7 +33,7 @@ function InitOverrideBindingsMapping()
util.ClearTable(KeybindIndexMap)
local index = 1
for _, button in ipairs(PTOptions.Buttons) do
if not util.ArrayContains(util.GetAllButtons(), button) then
if not util.GetAllButtonsSet()[button] then
for _, prefix in ipairs(BindingPrefixes) do
KeybindIndexMap[prefix..button] = index
end
@ -158,6 +158,8 @@ function HandleKeyPress(index)
local button = IndexButtonMap[index]
if keystate == "down" then
CurrentlyHeldButton = button
MouseoverFrame.pressed = true
MouseoverFrame:AdjustHealthPosition()
if button == "MOUSEWHEELUP" or button == "MOUSEWHEELDOWN" then
FakeMouseWheelHold(button)
end
@ -168,6 +170,8 @@ function HandleKeyPress(index)
else
if button ~= "MOUSEWHEELUP" and button ~= "MOUSEWHEELDOWN" then
CurrentlyHeldButton = nil
MouseoverFrame.pressed = false
MouseoverFrame:AdjustHealthPosition()
ReapplySpellsTooltip()
end
if PTOptions.CastWhenKey == "Key Up" then
@ -185,6 +189,10 @@ local MouseWheelHeldFaker_OnUpdate = function()
MouseWheelHeldFaker:SetScript("OnUpdate", nil)
if CurrentlyHeldButton == unholdButton then
CurrentlyHeldButton = nil
if MouseoverFrame then
MouseoverFrame.pressed = false
MouseoverFrame:AdjustHealthPosition()
end
ReapplySpellsTooltip()
end
end

View File

@ -744,8 +744,7 @@ function CreateTab_Customize()
if not PTOptions.FrameOptions[frameName] then
PTOptions.FrameOptions[frameName] = {}
end
local options = PTOptions.FrameOptions[frameName]
options.Hidden = self:GetChecked() == 1
PuppeteerSettings.SetFrameHidden(frameName, self:GetChecked() == 1)
Puppeteer.CheckGroup()
end)
layout:column(2):levelAt(1):layoutComponent(hideFrameCheckbox)

View File

@ -182,10 +182,10 @@ function PTButtonEditor:ContainsButton(button)
end
function PTButtonEditor:GetNumUsedBindings()
local nonBindingButtons = util.GetAllButtons()
local nonBindingButtons = util.GetAllButtonsSet()
local used = 0
for button, _ in pairs(self.LineMap) do
if not util.ArrayContains(nonBindingButtons, button) then
if not nonBindingButtons[button] then
used = used + 1
end
end

View File

@ -1005,6 +1005,11 @@ function GetAllButtons()
return buttons
end
local buttonsSet = ToSet(buttons, true)
function GetAllButtonsSet()
return buttonsSet
end
local upButtons = {}
for _, button in ipairs(buttons) do
table.insert(upButtons, button.."Up")