diff --git a/api/api.lua b/api/api.lua index 577c312b..48fc07b8 100644 --- a/api/api.lua +++ b/api/api.lua @@ -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) diff --git a/api/ui-widgets.lua b/api/ui-widgets.lua index 6f3c8130..9f7c4f65 100644 --- a/api/ui-widgets.lua +++ b/api/ui-widgets.lua @@ -661,7 +661,7 @@ function pfUI.api.SkinButton(button, cr, cg, cb, icon, disableHighlight) end b.UnlockHighlight = function() - if not MouseIsOver(b) then + if not MouseIsOverHitRect(b) then b:SetBackdropBorderColor(GetStringColor(pfUI_config.appearance.border.color)) end b.locked = false @@ -1175,7 +1175,7 @@ function pfUI.api.CreateInfoBox(text, time, parent, height) if GetTime() > infobox.lastshow + infobox.duration then if not infobox.fade:IsPlaying() then infobox.fade:Play() end - elseif MouseIsOver(this) then + elseif MouseIsOverHitRect(this) then this:SetAlpha(max(0.4, this:GetAlpha() - .1)) else this:SetAlpha(min(1, this:GetAlpha() + .1)) diff --git a/modules/actionbar.lua b/modules/actionbar.lua index 4b9fb865..9e752c91 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -317,7 +317,7 @@ pfUI:RegisterModule("actionbar", function () -- handle button highlight if keystate == "down" then self.highlight:Show() - elseif not MouseIsOver(self) then + elseif not MouseIsOverHitRect(self) then self.highlight:Hide() end end diff --git a/modules/equipmentmanager.lua b/modules/equipmentmanager.lua index 4197831d..efeb5e39 100644 --- a/modules/equipmentmanager.lua +++ b/modules/equipmentmanager.lua @@ -176,8 +176,8 @@ pfUI:RegisterModule("equipmentmanager", function() rowMenu:RegisterEvent("GLOBAL_MOUSE_DOWN") rowMenu:SetScript("OnEvent", function() if not this:IsShown() then return end - if MouseIsOver(this) then return end - if this.anchorBtn and MouseIsOver(this.anchorBtn) then return end + if MouseIsOverHitRect(this) then return end + if this.anchorBtn and MouseIsOverHitRect(this.anchorBtn) then return end this:Hide() end) tinsert(UISpecialFrames, "pfEqMgrRowMenu") -- Escape closes it @@ -313,10 +313,10 @@ pfUI:RegisterModule("equipmentmanager", function() -- Show the gear and tooltip while the cursor is over the row or its -- gear child. The gear sits inside the row's rectangle, so a single - -- MouseIsOver(row) check covers both. OnLeave on the row and the gear - -- catches every exit path, so no OnUpdate poll is needed. + -- MouseIsOverHitRect(row) check covers both. OnLeave on the row and the + -- gear catches every exit path, so no OnUpdate poll is needed. local function HideRowHover() - if MouseIsOver(row) then return end + if MouseIsOverHitRect(row) then return end GameTooltip:Hide() row.gear:Hide() end diff --git a/modules/gui.lua b/modules/gui.lua index 824913d2..f77b9d8d 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -58,10 +58,11 @@ pfUI:RegisterModule("gui", function () return end - if MouseIsOver(this) and not this.over then + local over = MouseIsOverHitRect(this) + if over and not this.over then this.tex:Show() this.over = true - elseif not MouseIsOver(this) and this.over then + elseif not over and this.over then this.tex:Hide() this.over = nil end diff --git a/modules/xpbar.lua b/modules/xpbar.lua index 90a78729..72541ffa 100644 --- a/modules/xpbar.lua +++ b/modules/xpbar.lua @@ -191,7 +191,7 @@ end local self = self or this if self.text_mouse == "1" then - self.bar.text:SetShown(MouseIsOver(self)) + self.bar.text:SetShown(self.hover) end if self.always then return end