From 787aa48532d2814b9ab6f885773ba6f2f72dac78 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Wed, 27 Aug 2014 11:59:27 +0200 Subject: [PATCH] Use a secure method of hiding the button when leaving it too --- Molinari.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Molinari.lua b/Molinari.lua index 811da10..183c7cb 100644 --- a/Molinari.lua +++ b/Molinari.lua @@ -1,4 +1,4 @@ -local Molinari = CreateFrame('Button', (...), UIParent, 'SecureActionButtonTemplate, SecureHandlerStateTemplate, AutoCastShineTemplate') +local Molinari = CreateFrame('Button', (...), UIParent, 'SecureActionButtonTemplate, SecureHandlerStateTemplate, SecureHandlerEnterLeaveTemplate, AutoCastShineTemplate') RegisterStateDriver(Molinari, 'visible', '[nomod:alt] hide; show') Molinari:SetAttribute('_onstate-visible', [[ if(newstate == 'hide' and self:IsShown()) then @@ -22,13 +22,6 @@ function Molinari:OnClick(button, ...) end end -function Molinari:OnLeave() - if(not InCombatLockdown()) then - self:ClearAllPoints() - self:Hide() - end -end - function Molinari:Apply(itemLink, spell, r, g, b) local parent = GetMouseFocus() local slot = parent:GetID() @@ -54,6 +47,7 @@ function Molinari:Apply(itemLink, spell, r, g, b) end if(show) then + self:SetAttribute('_entered', true) self:SetAllPoints(parent) self:Show() @@ -98,8 +92,9 @@ Molinari:SetScript('OnEvent', function(self) self:Hide() self:RegisterForClicks('AnyUp') self:SetFrameStrata('TOOLTIP') + self:SetAttribute('_onleave', 'self:ClearAllPoints() self:Hide()') self:SetScript('OnHide', AutoCastShine_AutoCastStop) - self:SetScript('OnLeave', self.OnLeave) + self:HookScript('OnLeave', AutoCastShine_AutoCastStop) self:HookScript('OnClick', self.OnClick) for _, sparkle in next, self.sparkles do -- 1.7.9.5