mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-23 12:30:50 +00:00
ui-widgets: use onupdate to determine button state
This commit is contained in:
+10
-14
@@ -763,23 +763,19 @@ function pfUI.api.SkinArrowButton(button, dir, size)
|
|||||||
|
|
||||||
button.icon:SetTexture(pfUI.media["img:"..dir])
|
button.icon:SetTexture(pfUI.media["img:"..dir])
|
||||||
|
|
||||||
if not button.pfScripted then
|
if not button.pficonfade then
|
||||||
RunOOC(function()
|
local button, state = button, nil
|
||||||
local enable = button.Enable
|
button.pficonfade = CreateFrame("Frame", nil, button)
|
||||||
local disable = button.Disable
|
button.pficonfade:SetScript("OnUpdate", function()
|
||||||
|
if state == button:IsEnabled() then return end
|
||||||
|
state = button:IsEnabled()
|
||||||
|
|
||||||
button.Enable = function(self)
|
if state > 0 then
|
||||||
if enable then enable(self) end
|
button.icon:SetVertexColor(.8,.8,.8,1)
|
||||||
self.icon:SetVertexColor(.8,.8,.8,1)
|
else
|
||||||
end
|
button.icon:SetVertexColor(.2,.2,.2,1)
|
||||||
|
|
||||||
button.Disable = function(self)
|
|
||||||
if disable then disable(self) end
|
|
||||||
self.icon:SetVertexColor(.2,.2,.2,1)
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
button.pfScripted = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user