ui-widgets: only write enter/leave once per button

This commit is contained in:
shagu
2019-03-31 14:59:20 +02:00
parent 73eeaacf05
commit 265f81ce80
+17 -12
View File
@@ -307,17 +307,22 @@ function pfUI.api.SkinButton(button, cr, cg, cb)
b:SetHighlightTexture(nil)
b:SetPushedTexture(nil)
b:SetDisabledTexture(nil)
local funce = b:GetScript("OnEnter")
local funcl = b:GetScript("OnLeave")
b:SetScript("OnEnter", function()
if funce then funce() end
pfUI.api.CreateBackdrop(b, nil, true)
b:SetBackdropBorderColor(cr,cg,cb,1)
end)
b:SetScript("OnLeave", function()
if funcl then funcl() end
pfUI.api.CreateBackdrop(b, nil, true)
end)
if not b.pfEnterLeave then
local funce = b:GetScript("OnEnter")
local funcl = b:GetScript("OnLeave")
b:SetScript("OnEnter", function()
if funce then funce() end
pfUI.api.CreateBackdrop(b, nil, true)
b:SetBackdropBorderColor(cr,cg,cb,1)
end)
b:SetScript("OnLeave", function()
if funcl then funcl() end
pfUI.api.CreateBackdrop(b, nil, true)
end)
b.pfEnterLeave = true
end
b:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE")
end
@@ -783,4 +788,4 @@ function pfUI.api.CreateInfoBox(text, time, parent, height)
infobox:SetFrameStrata("FULLSCREEN_DIALOG")
infobox:Show()
end
end