Use a secure method of hiding the button when leaving it too
Adrian L Lange [08-27-14 - 09:59]
Use a secure method of hiding the button when leaving it too
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