diff WorldQuests.lua @ 74:2ba11b25aa7f

flight map data handler adjustments
author Nenue
date Sat, 08 Apr 2017 17:07:58 -0400
parents 25f7dbc20a72
children 78d78dc77822
line wrap: on
line diff
--- a/WorldQuests.lua	Fri Apr 07 07:20:28 2017 -0400
+++ b/WorldQuests.lua	Sat Apr 08 17:07:58 2017 -0400
@@ -229,8 +229,7 @@
     local questID = ...
     self:UpdateBounties(event)
     if questID and db.QuestsByID[questID] then
-      self:ReleasePin(db.QuestsByID[questID])
-      rprint('|cFFFF4400release|r', questID)
+      db.QuestsByID[questID].complete = true
     end
     self:Refresh(event)
   elseif event == 'SKILL_LINES_CHANGED' or event == 'CURRENT_SPELL_CAST_CHANGED' then
@@ -361,7 +360,7 @@
     if info.x and info.y then
       pin.x = info.x or pin.x
       pin.y = info.y or pin.y
-      rprint('|cFFFF4400coords|r', info.x, info.y)
+      --rprint('|cFFFF4400coords|r', info.x, info.y)
     end
   end
 
@@ -513,7 +512,7 @@
 
   if self:IsVisible() then
     print('|cFF00FFFFRefreshIfChanged()|r', refreshReason)
-    self:Refresh()
+    self:Refresh('WORLDMAP_QUEUED')
   else
     rprint('|cFF00FFFFRefreshIfChanged()|r flagging for later refresh', refreshReason)
     self.isStale = true
@@ -537,49 +536,33 @@
     return
   end
 
+
+  local doUpdate = pin:GetCriteriaState() or pin.isStale
   --print('  |- ', pin.questID, pin.title)
   rprint('|cFF00FF00update|r', pin.questID, pin.title)
+
+  print(doUpdate)
+
   if x and y then
     local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
     pin:SetFrameLevel(PinBaseIndex+pin:GetID())
     pin.owningFrame = WorldMapFrame
     pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight, scaleFactor)
+    doUpdate = true
     --tinsert(self.UsedPositions, pin)
   end
 
-  local isCriteria, isBounty
-  if pin.factionID then
-    if db.BountiesByFactionID[pin.factionID] then
-      isCriteria = true
-    end
-    if selectedBountyQuestID then
-      isBounty = IsQuestCriteriaForBounty(pin.questID, selectedBountyQuestID) and true or nil
-    end
-  end
-
-  local isSpellTarget
-  if canTargetQuests then
-    isSpellTarget = IsQuestIDValidSpellTarget(pin.questID)
-  end
-
-  if (pin.isBounty ~= isBounty) or (pin.isCriteria ~= isCriteria) or (pin.isSpellTarget ~= isSpellTarget) then
-    pin.isSpellTarget = isSpellTarget
-    pin.isBounty = isBounty
-    pin.isCriteria = isCriteria
+  if doUpdate then
+    print(' changed', pin.title, pin.isCriteria, pin.isBounty, pin.scaleFactor)
     if pin:IsVisible() then
-      --print(' changed', pin.title)
       --numUpdated = numUpdated + 1
-      pin:Refresh('BOUNTY_UPDATE')
+      pin:Refresh('WORLDMAP_REFRESH')
     else
       --numHidden = numHidden + 1
       pin.isStale = true
     end
   end
 
-  if self:IsVisible() and (pin.isStale) then
-    pin:Refresh()
-  end
-
   if mapID then
     if not db.QuestsByZone[mapID] then
       db.QuestsByZone[mapID] = {}
@@ -600,9 +583,13 @@
 function Module:UpdateAnchors ()
   wipe(self.UsedPositions)
   print('  |cFF00FF00'..self:GetName()..':UpdateAnchors()')
-  self.hostWidth, self.hostHeight = WorldMapPOIFrame:GetSize()
-  self.nudgeThrescholdX = 16/self.hostWidth
-  self.nudgeThrescholdY = 16/self.hostHeight
+  local hostWidth, hostHeight = WorldMapPOIFrame:GetSize()
+
+  if (hostWidth ~= self.hostWidth) or (hostHeight ~= self.hostHeight) then
+    self.hostWidth, self.hostHeight = hostWidth, hostHeight
+    layoutDirty = true
+  end
+
 
   rprint('|cFF00FF00'..self:GetName()..':UpdateAnchors()')
   local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo()