diff 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
line wrap: on
line diff
--- a/Veneer.lua	Thu Oct 20 04:08:11 2016 -0400
+++ b/Veneer.lua	Fri Oct 21 18:03:35 2016 -0400
@@ -125,7 +125,6 @@
   self:StartMoving()
 end
 
-
 function VeneerCore:OnDragStop()
   self:StopMovingOrSizing()
 end
@@ -164,8 +163,6 @@
   if not insertPosition then
     insertPosition = #clusterTable + 1
   end
-
-
   return primaryAnchor, clusterTable, insertPosition
 end
 
@@ -181,7 +178,6 @@
   tinsert(clusterTable, clusterIndex, handler)
   print('cluster', anchorGroup, 'table', clusterTable, 'position', clusterIndex)
 
-
   handler.anchorCluster = clusterTable
   handler.anchorIndex = clusterIndex
   for k,v in pairs(VeneerHandlerMixin) do
@@ -197,7 +193,6 @@
       handler.initialized = true
     end
     self:InternalReanchor(handler)
-
   end
 end
 
@@ -227,8 +222,6 @@
       print('  |cFF00FF00'..index, frame:GetName(), frame:IsVisible())
       if frame:IsVisible() then
         anchorPoint = frame.anchorPoint
-
-
         frame:ClearAllPoints()
         if lastFrame then
           frame:SetPoint(anchorPoint, lastFrame, ANCHOR_OFFSET_POINT[anchorPoint], 0, 0)
@@ -250,7 +243,6 @@
   local subPoint, subTo
   local nextFrame
   for index, frame in ipairs(handler.anchorCluster) do
-
     print('  |cFF00FF00'..index, frame:GetName(), frame:IsVisible())
     if frame:IsVisible() then
       if frame ~= handler then
@@ -288,44 +280,19 @@
 end
 
 function VeneerCore:SlideBlock(frame, ...)
+  local aX, aY = frame:GetLeft(), frame:GetTop()
 
-  local anchorPoint, parent, anchorTo, pX,pY = ...
-  print('  |cFF0088FFSlide:|r', frame, 'to', parent, pX,pY)
-  local qX, qY = pX, pY
-  local bX, bY
-  local dX, dY = 0, 0
-  local aX, aY = frame:GetLeft(), frame:GetTop()
-  local str = ''
-  if not aX then
-    dY = ((anchorPoint == 'TOP') and frame:GetHeight()) or (((anchorPoint == 'BOTTOM') and -frame:GetHeight()) or 0)
-    dX = ((anchorPoint == 'LEFT') and -frame:GetWidth()) or (((anchorPoint == 'RIGHT') and frame:GetWidth()) or 0)
-    qX = pX + dX
-    qY = pY + dY
-    aX, aY = qX, qY
-    bX, bY = pX, pY
-    str = '|cFFFFFF00relative|r'
-  else
-    frame:ClearAllPoints()
+  frame:SetPoint('TOPLEFT', frame, 'BOTTOMLEFT', aX, aY)
+  frame.animation = frame.animation or {}
+  frame.animation.startX = aX
+  frame.animation.startY = aY
 
-    bX, bY = frame:GetLeft(), frame:GetTop()
-    dX, dY = (bX-aX), (bY-aY)
+  local targetPoint, targetParent, targetAnchor, offsetX, offsetY = ...
+  frame.BlockSlide:SetScript('OnFinished', function()
+    frame:SetPoint(targetPoint, targetParent, targetAnchor, offsetX, offsetY)
+    VeneerAnimationMixin.OnFinished(frame)
+  end)
 
-    str = '|cFFFFFF00existing|r'
-  end
-
-  if ((dX ~= 0) or (dY ~= 0)) and frame.BlockSlide then
-    print('  |cFF00FF88Slide result:|r',str, dX, dY)
-
-    frame:ClearAllPoints()
-    frame:SetPoint(anchorPoint, parent, anchorTo, qX, qY)
-    frame.BlockSlide.dX = dX
-    frame.BlockSlide.dY = dY
-    frame.BlockSlide.sourcePoint = {anchorPoint, parent, anchorTo, qX, qY}
-    frame.BlockSlide.destPoint = {anchorPoint, parent, anchorTo, pX,pY}
-    frame.BlockSlide.translation:SetOffset(dX, dY)
-    frame.BlockSlide:Play()
-    return
-  end
 end
 
 
@@ -500,14 +467,16 @@
 
 function VeneerAnimationMixin:OnPlay()
   PlaySoundKitID(229)
+  self.animating = true
   print('|cFF00FF00Anim:OnPlay|r @', unpack(self.sourcePoint))
 end
 function VeneerAnimationMixin:OnStop()
   PlaySoundKitID(229)
+  self.animating = nil
+  print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint))
 end
 function VeneerAnimationMixin:OnFinished()
   PlaySoundKitID(229)
+  self.animating = nil
   print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint))
-  self:GetParent():ClearAllPoints()
-  self:GetParent():SetPoint(unpack(self.destPoint))
 end
\ No newline at end of file