comparison Modules/PaperDoll.lua @ 76:83b3cdaae6a5

refactor into addons
author Nenue
date Sat, 27 Aug 2016 10:45:05 -0400
parents d9d16e67725c
children bb6b532c5d2f
comparison
equal deleted inserted replaced
75:d9d16e67725c 76:83b3cdaae6a5
114 else 114 else
115 frame:Hide() 115 frame:Hide()
116 end 116 end
117 end 117 end
118 118
119 local UpdateNext = function(frame)
120
121 plugin.next(function()
122 print('updating', frame:GetName())
123 UpdateVeneer(frame:GetParent(), frame)
124 end)
125 end
126
127
119 local UpdateAll = function() 128 local UpdateAll = function()
120 for index, frame in pairs(vnslot) do 129 for index, frame in pairs(vnslot) do
121 if frame:IsVisible() then 130 if frame:IsVisible() then
122 print('forcing', index, frame:GetName()) 131 print('forcing', index, frame:GetName())
123 tinsert(pendingSlots, frame) 132 UpdateNext(frame)
124 end 133 end
125 end 134 end
126 plugin.ticker()
127 end
128
129 local UpdateNext = function()
130
131 local frame = tremove(pendingSlots)
132 if frame and frame:IsVisible() then
133 print('updating', frame:GetName())
134 UpdateVeneer(frame:GetParent(), frame)
135 else
136
137 ticker:Cancel()
138 ticker = nil
139 end
140
141 end 135 end
142 136
143 137
144 -- PaperDollFrame is separate from InspectUI handlers 138 -- PaperDollFrame is separate from InspectUI handlers
145 local PaperDollItemSlotButton_Update = function(self) 139 local PaperDollItemSlotButton_Update = function(self)
175 frame.label:SetPoint(slot_anchors[slot], frame, slot_anchors[slot]) 169 frame.label:SetPoint(slot_anchors[slot], frame, slot_anchors[slot])
176 170
177 tinsert(pendingSlots, frame) 171 tinsert(pendingSlots, frame)
178 end 172 end
179 173
180 plugin.ticker() 174 end
181 end 175
182 176
183
184 plugin.ticker = function()
185 if (not ticker) and #pendingSlots >= 1 then
186 ticker = C_Timer.NewTicker(0, UpdateNext)
187 end
188 end
189 177
190 178
191 plugin.event = function(self, event, ...) 179 plugin.event = function(self, event, ...)
192 print(self, event, flag, slot) 180 print(self, event, flag, slot)
193 181