From 265f81ce80a768e496d04aa872ac7a8e8db26aa9 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 17 Feb 2019 17:23:01 +0100 Subject: [PATCH] ui-widgets: only write enter/leave once per button --- api/ui-widgets.lua | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/api/ui-widgets.lua b/api/ui-widgets.lua index ebeb9147..c81ab8f9 100644 --- a/api/ui-widgets.lua +++ b/api/ui-widgets.lua @@ -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 \ No newline at end of file +end