diff --git a/Modules/Bars.lua b/Modules/Bars.lua index 8fec1ce..3d2898d 100644 --- a/Modules/Bars.lua +++ b/Modules/Bars.lua @@ -144,15 +144,12 @@ local optionsDefaults = { }, } -local frame_cache = {} local intersectTimer local intersectUpdate = function() - if GetMouseFocus() and GetMouseFocus() ~= UIParent then - frame_cache[GetMouseFocus()] = true - end - for k, widget in pairs(mod.bars or {}) do - if widget.config.intersect and type(widget.bar) == "table" then - for frame in pairs(frame_cache) do + local frame = GetMouseFocus() + if frame ~= UIParent then + for k, widget in pairs(mod.bars or {}) do + if widget.config.intersect and type(widget.bar) == "table" then if environment.Intersect(widget.bar, frame, widget.config.xPad1 or 0, widget.config.yPad1 or 0, widget.config.xPad2 or 0, widget.config.yPad2 or 0) then widget.hidden = true widget.bar:Hide() diff --git a/Modules/Histograms.lua b/Modules/Histograms.lua index e64f147..fdb1a3d 100644 --- a/Modules/Histograms.lua +++ b/Modules/Histograms.lua @@ -198,20 +198,17 @@ local optionsDefaults = { }, } -local frame_cache = {} local insersectTimer local intersectUpdate = function() - if GetMouseFocus() and GetMouseFocus() ~= UIParent then - frame_cache[GetMouseFocus()] = true - end - for k, widget in pairs(mod.histograms or {}) do - for parent in pairs(frame_cache) do + local frame = GetMouseFocus() + if frame ~= UIParent then + for k, widget in pairs(mod.histograms or {}) do for i, bar in ipairs(widget.bars or {}) do if widget.config.intersect then - if environment.Intersect(bar, parent, widget.config.xPad1 or 0, widget.config.yPad1 or 0, widget.config.xPad2 or 0, widget.config.yPad2 or 0) then + if environment.Intersect(bar, frame, widget.config.xPad1 or 0, widget.config.yPad1 or 0, widget.config.xPad2 or 0, widget.config.yPad2 or 0) then widget.hidden = true bar:Hide() - elseif environment.Intersect(bar, parent, widget.config.xPad1 or 0, widget.config.yPad1 or 0, widget.config.xPad2 or 0, widget.config.yPad2 or 0) and widget.hidden then + elseif environment.Intersect(bar, frame, widget.config.xPad1 or 0, widget.config.yPad1 or 0, widget.config.xPad2 or 0, widget.config.yPad2 or 0) and widget.hidden then widget.hidden = false bar:Show() end diff --git a/Modules/Text.lua b/Modules/Text.lua index 2db9fab..26f95c2 100644 --- a/Modules/Text.lua +++ b/Modules/Text.lua @@ -271,25 +271,22 @@ local optionsDefaults = { }, } -local frame_cache = {} local intersectTimer local intersectUpdate = function() - if GetMouseFocus() and GetMouseFocus() ~= UIParent then - frame_cache[GetMouseFocus()] = true - end + local frame = GetMouseFocus() + if frame ~= UIParent then for k, widget in pairs(mod.texts) do - for parent in pairs(frame_cache) do - if widget.config.intersect then - if environment.Intersect(widget.text, parent, widget.config.xPad1 or 0, widget.config.yPad1 or 0, widget.config.xPad2 or 0, widget.config.yPad2 or 0) then - widget.hidden = true - widget.text:Hide() - elseif not environment.Intersect(widget.text, parent, widget.config.xPad1 or 0, widget.config.yPad1 or 0, widget.config.xPad2 or 0, widget.config.yPad2 or 0) and widget.hidden then - widget.hidden = false - widget.text:Show() - end + if widget.config.intersect then + if environment.Intersect(widget.text, frame, widget.config.xPad1 or 0, widget.config.yPad1 or 0, widget.config.xPad2 or 0, widget.config.yPad2 or 0) then + widget.hidden = true + widget.text:Hide() + elseif not environment.Intersect(widget.text, frame, widget.config.xPad1 or 0, widget.config.yPad1 or 0, widget.config.xPad2 or 0, widget.config.yPad2 or 0) and widget.hidden then + widget.hidden = false + widget.text:Show() end end end + end end function updateText(widget)