From 82892e287013cabfaf2d7602644c890ca3bdf513 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Fri, 19 Dec 2014 09:00:48 +0100 Subject: [PATCH] Rework the click passthrough to be more accurate --- Molinari.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Molinari.lua b/Molinari.lua index c68ceaf..6878d68 100644 --- a/Molinari.lua +++ b/Molinari.lua @@ -14,16 +14,23 @@ Molinari:SetAttribute('_onstate-visible', [[ end ]]) -local scripts = {'OnClick', 'OnMouseUp', 'OnMouseDown'} -Molinari:HookScript('OnClick', function(self, button, ...) +Molinari:HookScript('OnClick', function(self, button, down) if(button ~= 'LeftButton') then local _, parent = self:GetPoint() if(parent) then - for _, script in next, scripts do - local handler = parent:GetScript(script) - if(handler) then - handler(parent, button, ...) - end + local onClick = parent:GetScript('OnClick') + if(onClick) then + onClick(self, button, down) + end + + local onMouseDown = parent:GetScript('OnMouseDown') + if(down and onMouseDown) then + onMouseDown(self, button) + end + + local onMouseUp = parent:GetScript('OnMouseUp') + if(not down and onMouseUp) then + onMouseUp(self, button) end end end -- 1.7.9.5