Skip to content

Commit bfe01fd

Browse files
committed
Fix unit hotkeys rendering below compact unit frames
1 parent 3d13247 commit bfe01fd

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

ConsolePort/ConsolePort.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Title: Console Port
44
## Notes: Gamepad addon suite
55
## AddonCompartmentFunc: ConsolePort
6-
## Version: 3.0.31
6+
## Version: 3.0.32
77

88
## Author: Sebastian Lindfors
99
## X-Website: https://github.com/seblindfors/ConsolePort

ConsolePort/Controller/UnitHotkeys.lua

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -608,14 +608,27 @@ function HotkeyMixin:DrawIconsForBinding(binding)
608608
self:Adjust()
609609
end
610610

611-
function HotkeyMixin:SetUnitFrame(frame)
612-
if frame and frame:IsVisible() then
613-
self:SetParent(UIParent)
614-
self:SetPoint(UH.display.anchor, frame, UH.display.anchor, UH.display.offsetX, UH.display.offsetY)
615-
self:SetFrameStrata(frame:GetFrameStrata())
616-
self:SetFrameLevel(Clamp(frame:GetFrameLevel() + UH.display.level, 0, 10000))
617-
self:SetScale(1)
618-
self:Show()
611+
do -- Need this strata translation to ensure hotkeys are always above the unit frame,
612+
-- which in the case of compact unit frames requires to be a strata above.
613+
local strataMap = CPAPI.Enum(
614+
'BACKGROUND', 'LOW', 'MEDIUM', 'HIGH', 'DIALOG',
615+
'FULLSCREEN', 'FULLSCREEN_DIALOG', 'TOOLTIP'
616+
);
617+
local strataIndex = CPAPI.Proxy({strataMap()}, CPAPI.Static('TOOLTIP'));
618+
619+
local function GetHigherStrata(strata)
620+
return strataIndex[strataMap[strata] + 1];
621+
end
622+
623+
function HotkeyMixin:SetUnitFrame(frame)
624+
if frame and frame:IsVisible() then
625+
self:SetParent(UIParent)
626+
self:SetPoint(UH.display.anchor, frame, UH.display.anchor, UH.display.offsetX, UH.display.offsetY)
627+
self:SetFrameStrata(GetHigherStrata(frame:GetFrameStrata()))
628+
self:SetFrameLevel(Clamp(frame:GetFrameLevel() + UH.display.level, 0, 10000))
629+
self:SetScale(1)
630+
self:Show()
631+
end
619632
end
620633
end
621634

0 commit comments

Comments
 (0)