Skip to content

Commit 048cf49

Browse files
Timclaude
andcommitted
Fix Hover Highlight toggle and add Keypress Highlight control
- Fix: Keypress handler now respects show_pushed_texture setting - Add: New "Keypress Highlight" toggle in Control Menu - Rename: "Highlight Buttons" → "Hover Highlight" for clarity - Refactor: Reorganize Control Menu with compact spacing (35px) - Update: Frame height to 350px to accommodate new layout The Hover Highlight toggle was broken because keypress events bypassed the show_pushed_texture check. Now both hover and keypress highlighting can be controlled independently. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent fd5b2b9 commit 048cf49

2 files changed

Lines changed: 57 additions & 20 deletions

File tree

Core.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@ function addon:enable_keypress_input()
20662066
end
20672067

20682068
-- Also show the PushedTexture on the mapped action bar button
2069-
if button and button.active_slot then
2069+
if button and button.active_slot and keyui_settings.show_pushed_texture then
20702070
addon:show_pushed_texture(button.active_slot)
20712071
-- Hide pushed texture when key is released
20722072
if addon.pushed_ticker then addon.pushed_ticker:Cancel() end

Frames/Controls.lua

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function addon:create_controls()
3333

3434
-- Set the initial height based on expanded settings
3535
if keyui_settings.controls_expanded == true then
36-
controls_frame:SetHeight(320)
36+
controls_frame:SetHeight(350)
3737
else
3838
controls_frame:SetHeight(200)
3939
end
@@ -84,11 +84,10 @@ function addon:create_controls()
8484

8585
local layout_y = -40
8686
local size_y = -110
87-
local collapsed_y = -170
8887
local first_cb_y = -160
89-
local second_cb_y = -200
90-
local third_cb_y = -240
91-
local expanded_y = -290
88+
local second_cb_y = -195
89+
local third_cb_y = -230
90+
local fourth_cb_y = -280
9291

9392
-- Create Text "Layout"
9493
controls_frame.layout_text = controls_frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
@@ -298,15 +297,53 @@ function addon:create_controls()
298297
end)
299298

300299
-- Set the tooltip for the highlight buttons checkbox
301-
SetCheckboxTooltip(controls_frame.highlight_buttons_cb, "Toggle highlight effect on Blizzard action buttons when hovering KeyUI buttons")
300+
SetCheckboxTooltip(controls_frame.highlight_buttons_cb, "Highlight action bar buttons when hovering over KeyUI buttons")
302301

303-
-- Create the font string for the "Highlight Buttons" label text and position it
302+
-- Create the font string for the "Hover Highlight" label text and position it
304303
controls_frame.highlight_buttons_text = controls_frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
305-
controls_frame.highlight_buttons_text:SetText("Highlight Buttons")
304+
controls_frame.highlight_buttons_text:SetText("Hover Highlight")
306305
controls_frame.highlight_buttons_text:SetFont(addon:GetFont(), addon:GetFontSize(1.0))
307306
addon:RegisterFontString(controls_frame.highlight_buttons_text, 1.0)
308307
controls_frame.highlight_buttons_text:SetPoint("LEFT", controls_frame.highlight_buttons_cb, "RIGHT", 10, 0)
309308

309+
-- Create the checkbox for toggling keypress highlight effect (show_keypress_highlight)
310+
controls_frame.keypress_highlight_cb = CreateFrame("CheckButton", nil, controls_frame, "UICheckButtonArtTemplate")
311+
controls_frame.keypress_highlight_cb:SetSize(32, 36)
312+
controls_frame.keypress_highlight_cb:SetHitRectInsets(0, 0, 0, -10)
313+
controls_frame.keypress_highlight_cb:SetPoint("LEFT", controls_frame, "TOPLEFT", half_setpoint, third_cb_y)
314+
315+
-- Set the initial checkbox state based on the current setting for show_keypress_highlight
316+
if keyui_settings.show_keypress_highlight then
317+
controls_frame.keypress_highlight_cb:SetChecked(true)
318+
else
319+
controls_frame.keypress_highlight_cb:SetChecked(false)
320+
end
321+
322+
-- Set the OnClick script for the keypress highlight checkbox
323+
controls_frame.keypress_highlight_cb:SetScript("OnClick", function(s)
324+
if s:GetChecked() then
325+
keyui_settings.show_keypress_highlight = true
326+
if addon.open and not addon.in_combat then
327+
addon:enable_keypress_input()
328+
end
329+
else
330+
keyui_settings.show_keypress_highlight = false
331+
if addon.open then
332+
addon:disable_keypress_input()
333+
end
334+
end
335+
end)
336+
337+
-- Set the tooltip for the keypress highlight checkbox
338+
SetCheckboxTooltip(controls_frame.keypress_highlight_cb, "Highlight keys on the keyboard visualization when pressed (disabled during combat)")
339+
340+
-- Create the font string for the "Keypress Highlight" label text and position it
341+
controls_frame.keypress_highlight_text = controls_frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
342+
controls_frame.keypress_highlight_text:SetText("Keypress Highlight")
343+
controls_frame.keypress_highlight_text:SetFont(addon:GetFont(), addon:GetFontSize(1.0))
344+
addon:RegisterFontString(controls_frame.keypress_highlight_text, 1.0)
345+
controls_frame.keypress_highlight_text:SetPoint("LEFT", controls_frame.keypress_highlight_cb, "RIGHT", 10, 0)
346+
310347
-- Create the checkbox for toggling modifier detection (detect_modifier)
311348
controls_frame.detect_modifier_cb = CreateFrame("CheckButton", nil, controls_frame, "UICheckButtonArtTemplate")
312349
controls_frame.detect_modifier_cb:SetSize(32, 36)
@@ -375,11 +412,11 @@ function addon:create_controls()
375412
addon:RegisterFontString(controls_frame.dynamic_modifier_text, 1.0)
376413
controls_frame.dynamic_modifier_text:SetPoint("LEFT", controls_frame.dynamic_modifier_cb, "RIGHT", 10, 0)
377414

378-
-- Create a alt checkbox
415+
-- Create a alt checkbox (centered in fourth row with Ctrl and Shift)
379416
controls_frame.alt_cb = CreateFrame("CheckButton", nil, controls_frame, "UICheckButtonArtTemplate")
380417
controls_frame.alt_cb:SetSize(32, 36)
381418
controls_frame.alt_cb:SetHitRectInsets(0, 0, 0, -10)
382-
controls_frame.alt_cb:SetPoint("LEFT", controls_frame, "TOPLEFT", half_setpoint, third_cb_y)
419+
controls_frame.alt_cb:SetPoint("CENTER", controls_frame, "TOP", -130, fourth_cb_y)
383420

384421
-- Set the OnClick script for the checkbutton
385422
controls_frame.alt_cb:SetScript("OnClick", function(s)
@@ -412,7 +449,7 @@ function addon:create_controls()
412449
controls_frame.ctrl_cb = CreateFrame("CheckButton", nil, controls_frame, "UICheckButtonArtTemplate")
413450
controls_frame.ctrl_cb:SetSize(32, 36)
414451
controls_frame.ctrl_cb:SetHitRectInsets(0, 0, 0, -10)
415-
controls_frame.ctrl_cb:SetPoint("CENTER", controls_frame.alt_cb, "CENTER", 80, 0)
452+
controls_frame.ctrl_cb:SetPoint("CENTER", controls_frame.alt_cb, "CENTER", 110, 0)
416453

417454
-- Set the OnClick script for the checkbutton
418455
controls_frame.ctrl_cb:SetScript("OnClick", function(s)
@@ -444,7 +481,7 @@ function addon:create_controls()
444481
controls_frame.shift_cb = CreateFrame("CheckButton", nil, controls_frame, "UICheckButtonArtTemplate")
445482
controls_frame.shift_cb:SetSize(32, 36)
446483
controls_frame.shift_cb:SetHitRectInsets(0, 0, 0, -10)
447-
controls_frame.shift_cb:SetPoint("CENTER", controls_frame.ctrl_cb, "CENTER", 80, 0)
484+
controls_frame.shift_cb:SetPoint("CENTER", controls_frame.ctrl_cb, "CENTER", 110, 0)
448485

449486
-- Set the OnClick script for the checkbutton
450487
controls_frame.shift_cb:SetScript("OnClick", function(s)
@@ -474,15 +511,15 @@ function addon:create_controls()
474511

475512
-- Set the initial height based on expanded settings
476513
if keyui_settings.controls_expanded == true then
477-
controls_frame:SetHeight(320)
514+
controls_frame:SetHeight(350)
478515
else
479516
controls_frame:SetHeight(200)
480517
end
481518

482519
-- Helper function to set visibility of all control checkboxes
483520
local function set_controls_visibility(visible)
484521
local controls = {
485-
"empty_keys", "interface_keys", "highlight_buttons",
522+
"empty_keys", "interface_keys", "highlight_buttons", "keypress_highlight",
486523
"detect_modifier", "dynamic_modifier",
487524
"alt", "ctrl", "shift"
488525
}
@@ -500,14 +537,14 @@ function addon:create_controls()
500537
-- Update the expander text and controls visibility based on the new state
501538
if keyui_settings.controls_expanded then
502539
controls_frame.expander_text:SetText(HUD_EDIT_MODE_COLLAPSE_OPTIONS)
503-
controls_frame:SetHeight(320)
540+
controls_frame:SetHeight(350)
504541
set_controls_visibility(true)
505-
controls_frame.expander_text:SetPoint("CENTER", controls_frame, "TOP", 0, expanded_y)
542+
controls_frame.expander_text:SetPoint("CENTER", controls_frame, "BOTTOM", 0, 30)
506543
else
507544
controls_frame.expander_text:SetText(HUD_EDIT_MODE_EXPAND_OPTIONS)
508545
controls_frame:SetHeight(200)
509546
set_controls_visibility(false)
510-
controls_frame.expander_text:SetPoint("CENTER", controls_frame, "TOP", 0, collapsed_y)
547+
controls_frame.expander_text:SetPoint("CENTER", controls_frame, "BOTTOM", 0, 30)
511548
end
512549
end
513550

@@ -538,9 +575,9 @@ function addon:create_controls()
538575

539576
-- Set initial expander position based on controls_expanded
540577
if keyui_settings.controls_expanded then
541-
controls_frame.expander_text:SetPoint("CENTER", controls_frame, "TOP", 0, expanded_y)
578+
controls_frame.expander_text:SetPoint("CENTER", controls_frame, "BOTTOM", 0, 30)
542579
else
543-
controls_frame.expander_text:SetPoint("CENTER", controls_frame, "TOP", 0, collapsed_y)
580+
controls_frame.expander_text:SetPoint("CENTER", controls_frame, "BOTTOM", 0, 30)
544581
end
545582

546583
-- Create the "Close" button

0 commit comments

Comments
 (0)