From 953f3cf7ee9722c2da7d26274c9c0fdd89c1c31a Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Thu, 14 Apr 2011 10:33:07 +0100 Subject: [PATCH] Scan registered frames when mouseover appears --- Clique.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Clique.lua b/Clique.lua index 2b858bb..77dde24 100755 --- a/Clique.lua +++ b/Clique.lua @@ -69,9 +69,21 @@ function addon:Initialize() self.header:SetAttribute("_onattributechanged", [[ if name == "hasunit" then - if value == "false" and danglingButton then + if danglingButton and value == "false" then + -- if we have a current button and we've lost the 'mouseover' unit + -- run the 'onleave' script for that button that is dangling. self:RunFor(danglingButton, self:GetAttribute("setup_onleave")) danglingButton = nil + elseif not danglingButton and value == "true" then + -- scan the registered frames to see if we are over one of them + for frame in pairs(ccframes) do + if frame:IsUnderMouse(true) and frame:IsVisible() then + -- run the 'onenter' script for this button + self:RunFor(frame, self:GetAttribute("setup_onenter")) + danglingButton = frame + return + end + end end end ]]) -- 1.7.9.5