Reparent instead of doing hide/show shits
This commit is contained in:
parent
84cbfd42da
commit
affdbef5c1
2
Init.lua
2
Init.lua
|
@ -40,6 +40,8 @@ function ns.OnLoad()
|
||||||
GVS:Show()
|
GVS:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Reparent the first 10 MerchantItem frames, so they only appear for buyback
|
||||||
|
for i=1,10 do _G["MerchantItem"..i]:SetParent(MerchantItem11) end
|
||||||
|
|
||||||
-- Clean up our frame factories
|
-- Clean up our frame factories
|
||||||
for i,v in pairs(ns) do if i:match("^New") then ns[i] = nil end end
|
for i,v in pairs(ns) do if i:match("^New") then ns[i] = nil end end
|
||||||
|
|
|
@ -63,9 +63,6 @@ function ns.NewMainFrame()
|
||||||
end)
|
end)
|
||||||
GVS:SetScript("OnEvent", Refresh)
|
GVS:SetScript("OnEvent", Refresh)
|
||||||
GVS:SetScript("OnShow", function(self)
|
GVS:SetScript("OnShow", function(self)
|
||||||
-- These are used by the buyback frame, so we can't hide them forever
|
|
||||||
for i=1,12 do _G["MerchantItem"..i]:Hide() end
|
|
||||||
|
|
||||||
local max = math.max(0, GetMerchantNumItems() - NUMROWS)
|
local max = math.max(0, GetMerchantNumItems() - NUMROWS)
|
||||||
scrollbar:SetMinMaxValues(0, max)
|
scrollbar:SetMinMaxValues(0, max)
|
||||||
scrollbar:SetValue(0)
|
scrollbar:SetValue(0)
|
||||||
|
@ -75,10 +72,7 @@ function ns.NewMainFrame()
|
||||||
GVS:RegisterEvent("MERCHANT_UPDATE")
|
GVS:RegisterEvent("MERCHANT_UPDATE")
|
||||||
GVS:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
|
GVS:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
|
||||||
end)
|
end)
|
||||||
GVS:SetScript("OnHide", function(self)
|
GVS:SetScript("OnHide", GVS.UnregisterAllEvents)
|
||||||
for i=1,12 do _G["MerchantItem"..i]:Show() end
|
|
||||||
self:UnregisterAllEvents()
|
|
||||||
end)
|
|
||||||
|
|
||||||
return GVS
|
return GVS
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue