@@ -608,14 +608,27 @@ function HotkeyMixin:DrawIconsForBinding(binding)
608608 self :Adjust ()
609609end
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
620633end
621634
0 commit comments