diff Libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua @ 124:e31b02b24488

Updated for 8.0 pre-patch and BfA.
author yellowfive
date Tue, 17 Jul 2018 09:57:39 -0700
parents e635cd648e01
children
line wrap: on
line diff
--- a/Libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua	Mon Feb 12 19:34:09 2018 -0800
+++ b/Libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua	Tue Jul 17 09:57:39 2018 -0700
@@ -2,10 +2,12 @@
 TreeGroup Container
 Container that uses a tree control to switch between groups.
 -------------------------------------------------------------------------------]]
-local Type, Version = "TreeGroup", 40
+local Type, Version = "TreeGroup", 41
 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
 
+local WoW80 = select(4, GetBuildInfo()) >= 80000
+
 -- Lua APIs
 local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type
 local math_min, math_max, floor = math.min, math.max, floor
@@ -162,7 +164,7 @@
 local function FirstFrameUpdate(frame)
 	local self = frame.obj
 	frame:SetScript("OnUpdate", nil)
-	self:RefreshTree()
+	self:RefreshTree(nil, true)
 end
 
 local function BuildUniqueValue(...)
@@ -300,6 +302,8 @@
 
 	["OnRelease"] = function(self)
 		self.status = nil
+		self.tree = nil
+		self.frame:SetScript("OnUpdate", nil)
 		for k, v in pairs(self.localstatus) do
 			if k == "groups" then
 				for k2 in pairs(v) do
@@ -388,8 +392,8 @@
 		end
 	end,
 
-	["RefreshTree"] = function(self,scrollToSelection)
-		local buttons = self.buttons 
+	["RefreshTree"] = function(self,scrollToSelection,fromOnUpdate)
+		local buttons = self.buttons
 		local lines = self.lines
 
 		for i, v in ipairs(buttons) do
@@ -420,6 +424,12 @@
 		local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18))
 		if maxlines <= 0 then return end
 
+		-- workaround for lag spikes on WoW 8.0
+		if WoW80 and self.frame:GetParent() == UIParent and not fromOnUpdate then
+			self.frame:SetScript("OnUpdate", FirstFrameUpdate)
+			return
+		end
+
 		local first, last
 		
 		scrollToSelection = status.scrollToSelection