-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisplayCollapse.lua
113 lines (102 loc) · 3.63 KB
/
DisplayCollapse.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---@class GT
local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker")
-- Localize global functions
local ipairs = ipairs
local math = math
local max = max
local next = next
local pairs = pairs
local select = select
local string = string
local table = table
local time = time
local tonumber = tonumber
local tostring = tostring
local type = type
local unpack = unpack
function GT:CollapseDisplay()
GT.Debug("CollapseDisplay", 1)
for itemID, itemFrame in pairs(GT.Display.Frames) do
if itemID < 9999999998 then
itemFrame:Hide()
end
if itemID == 9999999998 then
itemFrame:SetPoint("TOPLEFT", GT.baseFrame.backdrop, "TOPLEFT")
end
if itemID == 9999999999 then
itemFrame:SetPoint("TOPLEFT", GT.Display.Frames[9999999998], "BOTTOMLEFT")
end
end
end
function GT:ExpandDisplay()
GT.Debug("ExpandDisplay", 1)
for itemID, itemFrame in pairs(GT.Display.Frames) do
if itemID < 9999999998 then
itemFrame:Show()
end
end
GT:AllignRows()
end
function GT:CollapseManager(wait)
GT.Debug("CollapseManager", 1, wait, GT.db.profile.General.collapseDisplay, GT.db.profile.General.collapseTime)
if wait then
GT:wait(GT.db.profile.General.collapseTime, "CollapseManager", false)
return
end
if GT.db.profile.General.collapseDisplay then
GT:CollapseDisplay()
if GT.Display.Frames[9999999998] then
GT.Display.Frames[9999999998]:SetScript("OnEnter", function(self, motion)
if motion then
GT:ExpandDisplay()
GT.baseFrame.frame:SetScript("OnLeave", function(self, motion)
GT:wait(GT.db.profile.General.collapseTime, "CollapseManager", false)
GT.baseFrame.frame:SetScript("OnLeave", nil)
GT.baseFrame.frame:SetMouseClickEnabled(false)
end)
GT:ClearMouse()
end
end)
else
GT:SetupTotalsRow()
GT:AllignRows()
GT:AllignColumns()
GT:UpdateBaseFrameSize()
GT:CollapseManager(false)
end
if GT.Display.Frames[9999999999] then
GT.Display.Frames[9999999999]:SetScript("OnEnter", function(self, motion)
if motion then
GT:ExpandDisplay()
GT.baseFrame.frame:SetScript("OnLeave", function(self, motion)
GT:wait(GT.db.profile.General.collapseTime, "CollapseManager", false)
GT.baseFrame.frame:SetScript("OnLeave", nil)
GT.baseFrame.frame:SetMouseClickEnabled(false)
end)
GT:ClearMouse()
end
end)
end
else
GT:ExpandDisplay()
GT:wait(nil, "CollapseManager")
GT.baseFrame.frame:SetScript("OnLeave", nil)
GT:ClearMouse()
if #GT.Display.Order == 1 then
GT:PrepareDataForDisplay("CollapseManager", false)
end
end
end
function GT:ClearMouse()
GT.baseFrame.frame:SetMouseClickEnabled(false)
if GT.Display.Frames[9999999998] then
GT.Display.Frames[9999999998]:SetScript("OnEnter", nil)
GT.Display.Frames[9999999998]:SetMouseClickEnabled(false)
GT.Display.Frames[9999999998]:SetMouseMotionEnabled(false)
end
if GT.Display.Frames[9999999999] then
GT.Display.Frames[9999999999]:SetScript("OnEnter", nil)
GT.Display.Frames[9999999999]:SetMouseClickEnabled(false)
GT.Display.Frames[9999999999]:SetMouseMotionEnabled(false)
end
end