Test hover against the hit rect, not the bare frame rect

CreateBackdrop widens a frame's hit rect by the border, so mouse focus
and OnEnter/OnLeave cover a band that plain MouseIsOver reports as
outside. Add MouseIsOverHitRect, which passes the frame's hit rect
insets as MouseIsOver offsets, and use it at the unpadded call sites.
The XP bar's hover text follows the same OnEnter/OnLeave flag as its
fade.
This commit is contained in:
Brues
2026-10-22 21:36:27 -05:00
parent 9cb21b982b
commit b9f473c049
6 changed files with 24 additions and 11 deletions
+12
View File
@@ -1543,6 +1543,18 @@ function pfUI.api.BarButtonAnchor(button,basename,buttonindex,barsize,formfactor
return button._anchor
end
-- [ MouseIsOverHitRect ] --
-- Like MouseIsOver, but tests the frame's hit rect, the area the engine
-- uses for mouse focus and OnEnter/OnLeave. CreateBackdrop widens that
-- rect by the border, so plain MouseIsOver misses a band around the frame.
-- 'frame' the frame to test
-- return true when the cursor is inside the frame's hit rect
function pfUI.api.MouseIsOverHitRect(frame)
if not frame.GetHitRectInsets then return MouseIsOver(frame) end
local left, right, top, bottom = frame:GetHitRectInsets()
return MouseIsOver(frame, -top, bottom, left, -right)
end
-- [ Enable Autohide ] --
-- 'frame' the frame that should be hidden
function pfUI.api.EnableAutohide(frame, timeout, combat)