diff Modules/WorldState.lua @ 108:a41f6b74709a

- Handler number and boolean cluster arguments as positioning priority layer and "always top" respectively - Use SetShown and IsShown instead of IsVisible in doing full re-anchor checks
author Nick@Zahhak
date Sat, 25 Feb 2017 11:42:07 -0500
parents 74d6d97a2d24
children 1196c2bad31c
line wrap: on
line diff
--- a/Modules/WorldState.lua	Sun Jan 29 09:57:09 2017 -0500
+++ b/Modules/WorldState.lua	Sat Feb 25 11:42:07 2017 -0500
@@ -75,7 +75,7 @@
   self:RegisterEvent('PLAYER_ENTERING_WORLD')
   self:RegisterEvent('PLAYER_REGEN_ENABLED')
   self:RegisterEvent('PLAYER_REGEN_DISABLED')
-  Veneer:AddHandler(self, self.anchorPoint, true)
+  Veneer:AddHandler(self, self.anchorPoint, 2)
   SLASH_VENEERWORLDSTATE1 = "/vws"
   SLASH_VENEERWORLDSTATE2 = "/worldstate"
   SlashCmdList.VENEERWORLDSTATE = function()
@@ -86,12 +86,11 @@
 function VeneerWorldStateMixin:OnEvent(event, arg)
   print(event, arg)
   if event == 'PLAYER_ENTERING_WORLD' then
-    self:Show()
     self:Update()
   elseif event == 'PLAYER_REGEN_ENABLED' then
-    self:SetShown(true)
+    self:Update(true)
   elseif event == 'PLAYER_REGEN_DISABLED' then
-    self:SetShown(false)
+    self:Update(true)
   end
 end
 
@@ -106,13 +105,17 @@
   end
 end
 
+function VeneerWorldStateMixin:OnShow()
+  print('OnShow()', debugstack())
+end
+
 function VeneerWorldStateMixin:Reanchor(isUpdate)
   print('  |cFF0088FF'..self:GetName()..':Reanchor()|r', #self.modules, 'blocks')
   self.maxHeight = 0
   local lastFrame
   for i, frame in ipairs(self.modules) do
-    print('  '..frame:GetName()..':',frame:IsShown(), frame:IsVisible(), frame:GetHeight())
-    if frame:IsVisible() then
+    print('  '..frame:GetName()..':',frame:IsShown(), frame:GetHeight())
+    if frame:IsShown() then
       if lastFrame then
         frame:SetPoint('TOP', lastFrame, 'BOTTOM')
       else
@@ -123,13 +126,13 @@
       lastFrame = frame
     end
   end
-  if self.maxHeight == 0 then
-    print ('  hiding because there are no blocks')
-    self:Hide()
+  if (self.maxHeight == 0) or InCombatLockdown() then
+    print ('  hiding; combat =', InCombatLockdown())
+    self:SetShown(false)
   else
-    self:Show()
     print ('  height update:', self.maxHeight)
     self:SetHeight(self.maxHeight)
+    self:SetShown(true)
   end
 
   if not isUpdate then
@@ -155,7 +158,7 @@
 end
 
 function VeneerOrderHallMixin:OnLoad()
-  Veneer:AddHandler(self, 'TOP', true)
+  Veneer:AddHandler(self, 'TOP', 1)
 end
 
 function VeneerOrderHallMixin:OnEvent(event, ...)
@@ -187,7 +190,7 @@
   end
 
   OrderHallCommandBar:ClearAllPoints()
-  OrderHallCommandBar:SetPoint('TOP', UIParent, 'TOP')
+  OrderHallCommandBar:SetAllPoints(self)
   OrderHallCommandBar:SetWidth(600)
   OrderHallCommandBar.Background:SetColorTexture(0,0,0,0.5)
   OrderHallCommandBar.WorldMapButton:Hide()