changeset 54:b289eb3e6a32

- Fix stray pin text arising from pins that are never shown.
author Nenue
date Sat, 31 Dec 2016 17:31:39 -0500
parents 44baf4f35c7c
children 6a2e85836219
files QuestPOI.lua WorldPlan.lua WorldPlan.xml WorldQuests.lua
diffstat 4 files changed, 70 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/QuestPOI.lua	Fri Dec 30 20:43:58 2016 -0500
+++ b/QuestPOI.lua	Sat Dec 31 17:31:39 2016 -0500
@@ -30,7 +30,7 @@
 
 
 local PIN_REFRESH_DELAY = .5
-local PIN_REQUEST_DELAY = .2
+local PIN_REQUEST_DELAY = .1
 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"
 
@@ -272,7 +272,10 @@
   local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
   -- if the title is nil, then wait and try later
   if not questTitle then
-    self.isPending = true
+    if not self.isPending then
+      C_TaskQuest.RequestPreloadRewardData(questID)
+      self.isPending = true
+    end
     dprint('|cFFBB8844isPending=true|r|cFF00FFFF', self.questId)
   else
     self.title, self.factionID, self.capped = questTitle, factionID, capped
@@ -396,25 +399,20 @@
 
 function QuestPOI:OnShow ()
 
-  if self.isNew then
-    qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
-    --qprint('|cFFFFFF00popping new pin handler')
-    self:StartFade()
-  elseif not self.isAnimating then
-    self:SetAlpha(1) -- fix stuck alpha
-  end
-
   if self.isStale then
     qprint('|cFF0088FFflagged for refresh')
     self:Refresh()
   end
-  --WorldPlan:print(self:GetAlpha())
 
-  if not self.Overlay:IsShown() then
+  if self.isNew or (not self.Overlay:IsShown()) then
+    qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
+    --qprint('|cFFFFFF00popping new pin handler')
     self:StartFade()
   end
 
-
+  if not self.isAnimating then
+    self:SetAlpha(1) -- fix stuck alpha
+  end
   self.Overlay:SetShown(true)
 end
 function QuestPOI:OnHide()
@@ -426,8 +424,10 @@
 
 local overlayBaseIndex = 1300
 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight)
+  wqprint(self:GetName()..':SetAnchor', self.filtered, self.used)
   self:SetParent(owner)
   self:ClearAllPoints()
+  self:SetFrameLevel(overlayBaseIndex + self:GetID())
   self.Overlay:SetParent(owner)
   self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID())
   if (dX and dY) then
@@ -452,6 +452,7 @@
   self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
   self.isPending = true
   self.count = self.Overlay.count
+  self.Description = self.Overlay.Description
   self.timeLabel = self.Overlay.timeLabel
   self.updateRate = PIN_REQUEST_DELAY
   self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
@@ -556,21 +557,25 @@
 
   if self.itemName then
 
-    if self.itemNumber and self.itemNumber >= 1000 then
-      local numeral = floor(self.itemNumber/1000)
-      local decimal = mod(self.itemNumber, 1000)
-      local numberString = numeral
-      if decimal > 100 then
-        numberString = numberString .. '.' .. tostring(floor(decimal/100))
+    if self.itemNumber then
+      local numberString = self.itemNumber
+      if self.itemNumber >= 1000 then
+        local numeral = floor(self.itemNumber/1000)
+        local decimal = mod(self.itemNumber, 1000)
+        numberString = numeral
+        if decimal > 100 then
+          numberString = numberString .. '.' .. tostring(floor(decimal/100))
+        end
+        numberString = numberString .. 'k'
       end
-      numberString = numberString .. 'k'
       self.count:SetText(numberString)
     else
-      self.count:SetText(self.itemNumber)
+      self.count:SetText(nil)
     end
+  end
 
+  self.Description:SetText(self.title .. "\n" .. floor(self.x*100+.5) .. "," .. floor(self.y*100+.5))
 
-  end
   icon:SetMask("Interface\\Minimap\\UI-Minimap-Background")
   if self.itemTexture then
     --iconBorder:SetTexture(WORLD_QUEST_BORDER)
@@ -594,18 +599,18 @@
 
   iconBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background")
   iconBorder:SetTexture(PENDING_BORDER)
-  if isBounty then
-    iconBorder:SetVertexColor(0,.4,.9)
-  else
-    iconBorder:SetVertexColor(style.r, style.g, style.b, 1)
-  end
+  iconBorder:SetVertexColor(style.r, style.g, style.b, 1)
 
   iconBorder:SetDesaturated(true)
   iconBorder:SetAlpha(subStyle.alpha or 1)
 
   trackingBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background")
   trackingBorder:SetTexture(PENDING_BORDER)
-  trackingBorder:SetVertexColor(0,0,0,1)
+  if isBounty then
+    trackingBorder:SetVertexColor(.25,.5,1)
+  else
+    trackingBorder:SetVertexColor(0,0,0,1)
+  end
 
   self.tagIcon:SetShown((not self.filtered) and true or false)
   self.tagIcon:SetAtlas(self.tagAtlas)
--- a/WorldPlan.lua	Fri Dec 30 20:43:58 2016 -0500
+++ b/WorldPlan.lua	Sat Dec 31 17:31:39 2016 -0500
@@ -74,6 +74,7 @@
   }
 }
 
+
 db.DefaultConfig = {
   ShowAllProfessionQuests = false,
   DisplayContinentSummary = true,
@@ -83,6 +84,13 @@
   FadeWhileGrouped = false,
   FlightMapAlphaLimits = {1, 1, 1},
   FlightMapScalingLimits = {1, 3, 1.5},
+  --UntrackedColor = {},
+  --TrackedColor = {},
+  --CriteriaColor = {},
+  --RewardColorGold = {},
+  --RewardColorReagent = {},
+  --RewardColorArtifactPower = {},
+  --RewardColorCurrency = {},
 }
 
 
@@ -281,15 +289,15 @@
   local mapAreaID = GetCurrentMapAreaID()
   local isBrokenIsle = BROKEN_ISLE_MAPS[mapAreaID]
 
-
+  local isContinent = (mapAreaID == BROKEN_ISLES_ID)
   db.currentMapID = mapAreaID
-  db.isContinentMap = (mapAreaID == BROKEN_ISLES_ID)
+  db.isContinentMap = isContinent
   db.useContinentType = (WorldMapDetailFrame:GetScale() < 1)
 
   for _, module in ipairs(db.OrderedModules) do
     if module.OnMapInfo then
       print('  |cFF00FFFF'..module:GetName() .. ':OnMapInfo()|r')
-      module:OnMapInfo(isBrokenIsle, mapAreaID)
+      module:OnMapInfo(isBrokenIsle, isContinent, mapAreaID)
     end
   end
 end
--- a/WorldPlan.xml	Fri Dec 30 20:43:58 2016 -0500
+++ b/WorldPlan.xml	Sat Dec 31 17:31:39 2016 -0500
@@ -41,16 +41,11 @@
       <AnimationGroup parentKey="FadeIn" setToFinalAlpha="true" looping="NONE">
         <Alpha parentKey="FadeIn" duration="0.45" fromAlpha="0" toAlpha="1" order="1" />
         <Scripts>
-          <OnPlay>
-            self:GetParent().highlight:Show()
-          </OnPlay>
           <OnStop>
-            self:GetParent().highlight:Hide()
-            self:GetParent().isAnimating = nil
+            self:GetParent():EndFade()
           </OnStop>
           <OnFinished>
-            self:GetParent().highlight:Hide()
-            self:GetParent().isAnimating = nil
+            self:GetParent():EndFade()
           </OnFinished>
         </Scripts>
       </AnimationGroup>
@@ -130,7 +125,7 @@
       <OnLeave method="OnLeave" />
     </Scripts>
     <Frames>
-      <Frame parentKey="Overlay" setAllPoints="true">
+      <Frame parentKey="Overlay" name="$parentOverlay" setAllPoints="true" hidden="true">
         <Layers>
           <Layer level="OVERLAY">
             <FontString inherits="WorldPlanNumberFontThin" parentKey="count">
@@ -143,6 +138,11 @@
                 <Anchor point="TOP" x="0" y="0" />
               </Anchors>
             </FontString>
+            <FontString inherits="WorldPlanNumberFontThin" parentKey="Description">
+              <Anchors>
+                <Anchor point="TOP" relativePoint="BOTTOM" relativeKey="$parent.count" x="0" y="0" />
+              </Anchors>
+            </FontString>
           </Layer>
         </Layers>
       </Frame>
--- a/WorldQuests.lua	Fri Dec 30 20:43:58 2016 -0500
+++ b/WorldQuests.lua	Sat Dec 31 17:31:39 2016 -0500
@@ -132,8 +132,12 @@
   self:RegisterEvent('SKILL_LINES_CHANGED')
 end
 
-function Module:OnMapInfo()
+function Module:OnMapInfo(isBrokenIsle, isContinent, mapAreaID)
   print('|cFFFFFF00'..self:GetName()..':OnMapInfo()|r visible =', self:IsVisible())
+  if self.isContinent ~= isContinent then
+    self.sizesDirty = true
+  end
+  self.isContinent = isContinent
   if self:IsVisible() then
     self:Refresh(true)
   else
@@ -221,9 +225,10 @@
 
   if not pin.dataLoaded then
     pin:GetData()
-    C_TaskQuest.RequestPreloadRewardData(info.questId)
   end
 
+
+
   pin:IsFiltered()
   pin:IsShowable()
   pin.isStale = true
@@ -245,8 +250,8 @@
     end
     db.TasksByID[id] = nil
   end
-  pin:SetShown(false)
-  pin:ClearAllPoints()
+  pin:Hide()
+  pin.Overlay:Hide()
   tinsert(db.FreePins, pin)
 
   print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title)
@@ -419,7 +424,6 @@
 end
 
 function Module:Refresh(fromUser)
-  self.isUserTriggered = fromUser
   self.currentMapID = GetCurrentMapAreaID()
   rprint('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal')
   print('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal')
@@ -437,7 +441,7 @@
   self:UpdateAnchors(nil, fromUser)
   self:Cleanup (fromUser)
   self.isStale = nil
-  self.isUserTriggered = nil
+  self.sizesDirty = nil
 end
 
 -- update visibility states of all pins
@@ -465,12 +469,17 @@
   if x and y then
     pin.x = x
     pin.y = y
-    pin.throttle = 1
     pin:SetFrameLevel(PinBaseIndex+pin:GetID())
     pin:SetAnchor(self.hostFrame, pin.x, pin.y, self.hostWidth, self.hostHeight)
-    tinsert(self.UsedPositions, pin)
+    --tinsert(self.UsedPositions, pin)
   end
-
+  if self.sizesDirty then
+    if self:IsVisible() then
+      pin:Refresh()
+    else
+      pin.isStale = true
+    end
+  end
   if mapID then
     if not db.QuestsByZone[mapID] then
       db.QuestsByZone[mapID] = {}