comparison Veneer.lua @ 89:74e714637d6a

WorldStateProgress fade-in is called for all visibility check falses
author Nenue
date Fri, 21 Oct 2016 18:03:35 -0400
parents b107b4df7eb6
children 6e2cb847c3c6
comparison
equal deleted inserted replaced
88:b107b4df7eb6 89:74e714637d6a
122 end 122 end
123 123
124 function VeneerCore:OnDragStart() 124 function VeneerCore:OnDragStart()
125 self:StartMoving() 125 self:StartMoving()
126 end 126 end
127
128 127
129 function VeneerCore:OnDragStop() 128 function VeneerCore:OnDragStop()
130 self:StopMovingOrSizing() 129 self:StopMovingOrSizing()
131 end 130 end
132 131
162 primaryAnchor = 'TOPLEFT' 161 primaryAnchor = 'TOPLEFT'
163 end 162 end
164 if not insertPosition then 163 if not insertPosition then
165 insertPosition = #clusterTable + 1 164 insertPosition = #clusterTable + 1
166 end 165 end
167
168
169 return primaryAnchor, clusterTable, insertPosition 166 return primaryAnchor, clusterTable, insertPosition
170 end 167 end
171 168
172 function VeneerCore:AddHandler(handler, ...) 169 function VeneerCore:AddHandler(handler, ...)
173 print('*** Adding handler:', handler.moduleName or handler:GetName()) 170 print('*** Adding handler:', handler.moduleName or handler:GetName())
178 frame.clusterIndex = i + 1 175 frame.clusterIndex = i + 1
179 end 176 end
180 end 177 end
181 tinsert(clusterTable, clusterIndex, handler) 178 tinsert(clusterTable, clusterIndex, handler)
182 print('cluster', anchorGroup, 'table', clusterTable, 'position', clusterIndex) 179 print('cluster', anchorGroup, 'table', clusterTable, 'position', clusterIndex)
183
184 180
185 handler.anchorCluster = clusterTable 181 handler.anchorCluster = clusterTable
186 handler.anchorIndex = clusterIndex 182 handler.anchorIndex = clusterIndex
187 for k,v in pairs(VeneerHandlerMixin) do 183 for k,v in pairs(VeneerHandlerMixin) do
188 if not handler[k] then 184 if not handler[k] then
195 if handler.Setup and not handler.initialized then 191 if handler.Setup and not handler.initialized then
196 handler:Setup() 192 handler:Setup()
197 handler.initialized = true 193 handler.initialized = true
198 end 194 end
199 self:InternalReanchor(handler) 195 self:InternalReanchor(handler)
200
201 end 196 end
202 end 197 end
203 198
204 function VeneerCore:Reanchor() 199 function VeneerCore:Reanchor()
205 self:ExecuteOnClusters(nil, 'Reanchor') 200 self:ExecuteOnClusters(nil, 'Reanchor')
225 local lastFrame 220 local lastFrame
226 for index, frame in ipairs(cluster) do 221 for index, frame in ipairs(cluster) do
227 print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible()) 222 print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible())
228 if frame:IsVisible() then 223 if frame:IsVisible() then
229 anchorPoint = frame.anchorPoint 224 anchorPoint = frame.anchorPoint
230
231
232 frame:ClearAllPoints() 225 frame:ClearAllPoints()
233 if lastFrame then 226 if lastFrame then
234 frame:SetPoint(anchorPoint, lastFrame, ANCHOR_OFFSET_POINT[anchorPoint], 0, 0) 227 frame:SetPoint(anchorPoint, lastFrame, ANCHOR_OFFSET_POINT[anchorPoint], 0, 0)
235 else 228 else
236 frame:SetPoint(anchorPoint, UIParent, anchorPoint, 0, 0) 229 frame:SetPoint(anchorPoint, UIParent, anchorPoint, 0, 0)
248 local anchorPoint = handler.anchorPath or handler.anchorPoint 241 local anchorPoint = handler.anchorPath or handler.anchorPoint
249 local anchorParent, anchorTo = UIParent, anchorPoint 242 local anchorParent, anchorTo = UIParent, anchorPoint
250 local subPoint, subTo 243 local subPoint, subTo
251 local nextFrame 244 local nextFrame
252 for index, frame in ipairs(handler.anchorCluster) do 245 for index, frame in ipairs(handler.anchorCluster) do
253
254 print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible()) 246 print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible())
255 if frame:IsVisible() then 247 if frame:IsVisible() then
256 if frame ~= handler then 248 if frame ~= handler then
257 anchorParent = frame 249 anchorParent = frame
258 anchorTo = ANCHOR_OFFSET_POINT[anchorPoint] 250 anchorTo = ANCHOR_OFFSET_POINT[anchorPoint]
286 printFunc('|cFF88FF00'..handler:GetName()..':SetPoint(', handler.anchorPoint, anchorParent, anchorTo) 278 printFunc('|cFF88FF00'..handler:GetName()..':SetPoint(', handler.anchorPoint, anchorParent, anchorTo)
287 end 279 end
288 end 280 end
289 281
290 function VeneerCore:SlideBlock(frame, ...) 282 function VeneerCore:SlideBlock(frame, ...)
291
292 local anchorPoint, parent, anchorTo, pX,pY = ...
293 print(' |cFF0088FFSlide:|r', frame, 'to', parent, pX,pY)
294 local qX, qY = pX, pY
295 local bX, bY
296 local dX, dY = 0, 0
297 local aX, aY = frame:GetLeft(), frame:GetTop() 283 local aX, aY = frame:GetLeft(), frame:GetTop()
298 local str = '' 284
299 if not aX then 285 frame:SetPoint('TOPLEFT', frame, 'BOTTOMLEFT', aX, aY)
300 dY = ((anchorPoint == 'TOP') and frame:GetHeight()) or (((anchorPoint == 'BOTTOM') and -frame:GetHeight()) or 0) 286 frame.animation = frame.animation or {}
301 dX = ((anchorPoint == 'LEFT') and -frame:GetWidth()) or (((anchorPoint == 'RIGHT') and frame:GetWidth()) or 0) 287 frame.animation.startX = aX
302 qX = pX + dX 288 frame.animation.startY = aY
303 qY = pY + dY 289
304 aX, aY = qX, qY 290 local targetPoint, targetParent, targetAnchor, offsetX, offsetY = ...
305 bX, bY = pX, pY 291 frame.BlockSlide:SetScript('OnFinished', function()
306 str = '|cFFFFFF00relative|r' 292 frame:SetPoint(targetPoint, targetParent, targetAnchor, offsetX, offsetY)
307 else 293 VeneerAnimationMixin.OnFinished(frame)
308 frame:ClearAllPoints() 294 end)
309 295
310 bX, bY = frame:GetLeft(), frame:GetTop()
311 dX, dY = (bX-aX), (bY-aY)
312
313 str = '|cFFFFFF00existing|r'
314 end
315
316 if ((dX ~= 0) or (dY ~= 0)) and frame.BlockSlide then
317 print(' |cFF00FF88Slide result:|r',str, dX, dY)
318
319 frame:ClearAllPoints()
320 frame:SetPoint(anchorPoint, parent, anchorTo, qX, qY)
321 frame.BlockSlide.dX = dX
322 frame.BlockSlide.dY = dY
323 frame.BlockSlide.sourcePoint = {anchorPoint, parent, anchorTo, qX, qY}
324 frame.BlockSlide.destPoint = {anchorPoint, parent, anchorTo, pX,pY}
325 frame.BlockSlide.translation:SetOffset(dX, dY)
326 frame.BlockSlide:Play()
327 return
328 end
329 end 296 end
330 297
331 298
332 function VeneerCore:ExecuteOnClusters(layer, method) 299 function VeneerCore:ExecuteOnClusters(layer, method)
333 self.parserDepth = self.parserDepth + 1 300 self.parserDepth = self.parserDepth + 1
498 465
499 end 466 end
500 467
501 function VeneerAnimationMixin:OnPlay() 468 function VeneerAnimationMixin:OnPlay()
502 PlaySoundKitID(229) 469 PlaySoundKitID(229)
470 self.animating = true
503 print('|cFF00FF00Anim:OnPlay|r @', unpack(self.sourcePoint)) 471 print('|cFF00FF00Anim:OnPlay|r @', unpack(self.sourcePoint))
504 end 472 end
505 function VeneerAnimationMixin:OnStop() 473 function VeneerAnimationMixin:OnStop()
506 PlaySoundKitID(229) 474 PlaySoundKitID(229)
475 self.animating = nil
476 print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint))
507 end 477 end
508 function VeneerAnimationMixin:OnFinished() 478 function VeneerAnimationMixin:OnFinished()
509 PlaySoundKitID(229) 479 PlaySoundKitID(229)
480 self.animating = nil
510 print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint)) 481 print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint))
511 self:GetParent():ClearAllPoints() 482 end
512 self:GetParent():SetPoint(unpack(self.destPoint))
513 end