diff WorldQuests.lua @ 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
line wrap: on
line diff
--- 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
-