changeset 60:3d8e83ddf603

- hide text regions directly when their associated pin has been removed from the map
author Nick@Zahhak
date Wed, 08 Feb 2017 05:58:56 -0500
parents bc09961d5a98
children a133ee697ca2
files QuestPOI.lua WorldPlan.xml WorldQuests.lua
diffstat 3 files changed, 59 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/QuestPOI.lua	Wed Feb 01 17:44:20 2017 -0500
+++ b/QuestPOI.lua	Wed Feb 08 05:58:56 2017 -0500
@@ -430,18 +430,17 @@
     self:SetAlpha(db.PinAlpha) -- fix stuck alpha
   end
   if self.used then
-    self.Overlay:Show()
+    self.Overlay:SetShown(true)
   end
 
 end
 function QuestPOI:OnHide()
-  qprint('|cFFFFFF00'..self:GetID()..'r:OnHide()')
+  --DEFAULT_CHAT_FRAME:AddMessage('|cFFFFFF00'..self:GetName()..'|r:OnHide()')
+  self.Overlay:SetShown(false)
 
   -- reset flags
   self:SetAlpha(db.PinAlpha)
   self.isAnimating = nil
-  self.isStale = true
-  self.Overlay:Hide()
 end
 
 -- different from owningFrame
@@ -560,16 +559,21 @@
       self.HighlightBorder:SetVertexColor(0,0,0,0.7)
     end
     self.alertLevel = tl
+    self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1))
   else
-    WorldPlan:print('|cFFFFFF00'..tostring(self.title).. '|r is no longer active.')
-    self:Hide()
+    if not self.completed then
+      self.completed = true
+      WorldPlan:print('|cFFFFFF00'..tostring(self.title).. '|r is no longer active.')
+      self:SetShown(false)
+      self.Overlay:SetShown(false)
+    end
+
   end
-  self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1))
 end
 
-function QuestPOI:Refresh (fromUser)
+function QuestPOI:Refresh ()
 
-  rprint('|c'..(fromUser and 'FF0088FF' or 'FF00FF88' )..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title)
+  rprint('|cFF00FF88'..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title)
 
 
 
--- a/WorldPlan.xml	Wed Feb 01 17:44:20 2017 -0500
+++ b/WorldPlan.xml	Wed Feb 08 05:58:56 2017 -0500
@@ -126,6 +126,20 @@
     </Scripts>
     <Frames>
       <Frame parentKey="Overlay" name="$parentOverlay" setAllPoints="true" hidden="true">
+        <!--
+        <Scripts>
+          <OnShow>
+            local out = debugstack(3,3,1)
+            out = out:gsub("Interface%\\AddOns\\", "|cFFFF00FF\\|r")
+            print('POI', self:GetName().. ':OnShow()\n' .. out:gsub("Interface%\\", "|cFF00FFFF\\|r"))
+          </OnShow>
+          <OnHide>
+            local out = debugstack(3,3,1)
+            out = out:gsub("Interface%\\AddOns\\", "|cFFFF00FF\\|r")
+            print('POI', self:GetName().. ':OnHide()\n' .. out:gsub("Interface%\\", "|cFF00FFFF\\|r"))
+          </OnHide>
+        </Scripts>
+        -->
         <Layers>
           <Layer level="OVERLAY">
             <FontString inherits="WorldPlanNumberFontThin" parentKey="count">
--- a/WorldQuests.lua	Wed Feb 01 17:44:20 2017 -0500
+++ b/WorldQuests.lua	Wed Feb 08 05:58:56 2017 -0500
@@ -48,7 +48,7 @@
 end
 
 local InternalDoRefresh = function (self)
-  WorldPlanQuests:Refresh(true)
+  WorldPlanQuests:Refresh()
 end
 
 function Module:Setup()
@@ -259,8 +259,8 @@
     end
     db.TasksByID[id] = nil
   end
-  pin:Hide()
-  pin.Overlay:Hide()
+  pin:SetShown(false)
+  pin.Overlay:SetShown(false)
   tinsert(db.FreePins, pin)
 
   print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title)
@@ -432,23 +432,43 @@
   end
 end
 
-function Module:Refresh(fromUser)
+function Module:Refresh()
   self.currentMapID = GetCurrentMapAreaID()
-  rprint('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal')
-  print('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal')
+  rprint('|cFF00FF88'..self:GetName()..':Refresh()|r')
+  print('|cFF00FF88'..self:GetName()..':Refresh()|r')
   if not self:IsVisible() then
     print('  not visible, flag for later')
     self.isStale = true
     return self:MarkAllPins()
   end
-  wprint('  |cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal')
+  wprint('  |cFF00FF88'..self:GetName()..':Refresh()|r')
 
   for index, pin in pairs(db.QuestsByID) do
     pin.used = nil
   end
 
-  self:UpdateAnchors(nil, fromUser)
-  self:Cleanup (fromUser)
+  self:UpdateAnchors(nil)
+
+
+  print('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
+  rprint('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
+  --local showQuestPOI = db.Config.EnablePins
+  for questID, pin in pairs(db.QuestsByID) do
+    local oV = pin:IsShown()
+    if pin.used then
+      pin.throttle = 1
+      if oV == false then
+        print('|cFF00FF00cleanup +|r', questID, pin.title)
+      end
+      pin:SetShown(true)
+    else
+      if oV == true then
+        print('|cFFFF4400 -|r', questID, pin.title)
+      end
+      pin:SetShown(false)
+    end
+  end
+
   self.isStale = nil
   self.sizesDirty = nil
 
@@ -505,14 +525,14 @@
   end
 end
 
-function Module:UpdateAnchors (fromUser)
+function Module:UpdateAnchors ()
   wipe(self.UsedPositions)
-  print('  |cFF00FF00'..self:GetName()..':UpdateAnchors()', fromUser)
+  print('  |cFF00FF00'..self:GetName()..':UpdateAnchors()')
   self.hostWidth, self.hostHeight = WorldMapPOIFrame:GetSize()
   self.nudgeThrescholdX = 16/self.hostWidth
   self.nudgeThrescholdY = 16/self.hostHeight
   local print = rprint
-  print('|cFF00FF00'..self:GetName()..':UpdateAnchors()', fromUser)
+  print('|cFF00FF00'..self:GetName()..':UpdateAnchors()')
   local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo()
   if isMicroDungeon then
     return
@@ -535,27 +555,4 @@
   end
 end
 
--- shows, animates, or hides pins based on their current visibility flags
-function Module:Cleanup (fromUser)
 
-  print('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
-  local print = rprint
-  print('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
-  --local showQuestPOI = db.Config.EnablePins
-  for questID, pin in pairs(db.QuestsByID) do
-    local oV = pin:IsShown()
-    if pin.used then
-      pin.throttle = 1
-      if oV == false then
-        print('|cFF00FF00cleanup +|r', questID, pin.title)
-      end
-      pin:Show()
-    else
-      if oV == true then
-        print('|cFFFF4400 -|r', questID, pin.title)
-      end
-      pin:Hide()
-    end
-  end
-end
-