From 2f0e1a6c0728281d82f127005e0747f165d866e7 Mon Sep 17 00:00:00 2001 From: Jim Whitehead Date: Fri, 30 Sep 2016 21:25:27 +0200 Subject: [PATCH] Attempt to resolve the issue with "stuck" bindings There are some situations in which the mouseover unit can go away, and we're currently using this to detect if a frame might be obscuring the current one or if the current frame has been hidden. I have made this check smarter and it should be better at determining when to clear the bindings that have been set. If you want to view more information about when bindings are being clear (or not) you can run the following in-game: /run Clique.settings.debugUnitIssue = true /reload You can remove these messages later with the reverse: /run Clique.settings.debugUnitIssue = false /reload --- Clique.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Clique.lua b/Clique.lua index 270446b..fd2ff30 100755 --- a/Clique.lua +++ b/Clique.lua @@ -58,14 +58,21 @@ function addon:Initialize() -- This snippet will clear any dangling bindings that might have occurred -- as a result of frames being shown/hidden. - self.header:SetAttribute("_onattributechanged", [[ - if name == "hasunit" then - if value == "false" and danglingButton then + local oacScript = [[ + if name == "hasunit" and value == "false" and danglingButton then + -- Check if we should clear the bindings + if not danglingButton:IsUnderMouse() or not danglingButton:IsVisible() then + if {{debug}} then print("Clique: clearing bindings, unit lost") end self:RunFor(danglingButton, self:GetAttribute("setup_onleave")) danglingButton = nil + else + if {{debug}} then print("Clique: ignoring unit loss, frame still here") end end end - ]]) + ]] + oacScript = oacScript:gsub("{{debug}}", self.settings.debugUnitIssue and "true" or "false") + + self.header:SetAttribute("_onattributechanged", oacScript) RegisterAttributeDriver(self.header, "hasunit", "[@mouseover, exists] true; false") -- Create a secure action button that's sole purpose is to cancel a -- 1.7.9.5