changeset 62:abcdef801db5

- more region hiding fixes
author Nick@Zahhak
date Sat, 11 Feb 2017 14:25:57 -0500
parents a133ee697ca2
children 8e130c92698f
files QuestPOI.lua WorldPlan.lua WorldPlan.xml WorldQuests.lua
diffstat 4 files changed, 81 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/QuestPOI.lua	Wed Feb 08 13:11:07 2017 -0500
+++ b/QuestPOI.lua	Sat Feb 11 14:25:57 2017 -0500
@@ -260,7 +260,6 @@
   end
   WorldMap_AddQuestRewardsToTooltip(questID)
 
-  self.MouseGlow:Show()
   WorldMapTooltip:Show()
   --WorldMapTooltip.recalculatePadding = true;
   --print(WorldMapTooltip:GetParent())
@@ -271,7 +270,6 @@
     return
   end
   WorldMap_RestoreTooltip()
-  self.MouseGlow:Hide()
   WorldMapTooltip:Hide();
 end
 
@@ -421,7 +419,6 @@
   end
 
   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
@@ -429,17 +426,13 @@
   if not self.isAnimating then
     self:SetAlpha(db.PinAlpha) -- fix stuck alpha
   end
-  if self.used then
-    self.Overlay:SetShown(true)
-  end
 
+  self:ShowFrames()
 end
+
 function QuestPOI:OnHide()
   --DEFAULT_CHAT_FRAME:AddMessage('|cFFFFFF00'..self:GetName()..'|r:OnHide()')
-  self.Overlay:SetShown(false)
-  self.Overlay:SetShown(false)
-  self.timeLabel:SetShown(false)
-
+  self:HideFrames()
   -- reset flags
   self:SetAlpha(db.PinAlpha)
   self.isAnimating = nil
@@ -447,7 +440,13 @@
 
 -- different from owningFrame
 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight)
-  wqprint(self:GetName()..':SetAnchor', self.filtered, self.used)
+  wqprint(self:GetName()..':SetAnchor()', owner, dX, dY, self.filtered, self.used)
+  if not self.used then
+    self:HideFrames()
+    return
+  end
+
+
   self:SetParent(owner)
   self:ClearAllPoints()
   self:SetFrameLevel(pinBaseIndex + self:GetID())
@@ -465,7 +464,36 @@
   else
     self:SetPoint('CENTER')
   end
-  self:SetShown(self.used)
+
+  self:ShowFrames()
+end
+
+
+function QuestPOI:ShowFrames()
+  if not self:IsShown() then
+    self:SetShown(true)
+    print('|cFFFFFF00' ..self:GetName()..':ShowFrames()')
+    qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
+  else
+
+    --print(self:GetName()..':ShowFrames()')
+  end
+  self.count:SetShown(true)
+  self.Overlay:SetShown(true)
+  self.count:SetShown(true)
+  self.timeLabel:SetShown(true)
+end
+
+function QuestPOI:HideFrames()
+  if self:IsShown() then
+    print(self:GetName()..':HideFrames()')
+    self:SetShown(false)
+  end
+  self.count:SetShown(false)
+  self.Overlay:SetShown(false)
+  self.count:SetShown(false)
+  self.timeLabel:SetShown(false)
+  self.used = nil
 end
 
 function QuestPOI:OnLoad()
@@ -475,8 +503,8 @@
   self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
   self.isPending = true
   self.count = self.Overlay.count
+  self.timeLabel = self.Overlay.timeLabel
   self.Description = self.Overlay.Description
-  self.timeLabel = self.Overlay.timeLabel
   self.updateRate = PIN_REQUEST_DELAY
   self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
 
@@ -549,7 +577,7 @@
       end
     else
       if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then
-        self:SetShown(false)
+        self:HideFrames()
       end
     end
 
@@ -566,11 +594,8 @@
     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)
-      self.timeLabel:SetShown(false)
+      self:HideFrames()
     end
-
   end
 end
 
@@ -761,15 +786,13 @@
   trackingBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0))
 
 
-  if style.hasNumeric then
+  if (subStyle.showNumber and self.itemNumber) and style.hasNumeric then
     self.count:SetTextColor(unpack(style.numberRGB))
     if subStyle.numberFontObject then
       --wqprint('change font', _G[subStyle.numberFontObject]:GetName())
       self.count:SetFontObject(_G[subStyle.numberFontObject])
     end
+  else
+    self.count:SetText(nil)
   end
-
-  self.count:SetShown((subStyle.showNumber and self.itemNumber) and style.hasNumeric)
-
-
 end
\ No newline at end of file
--- a/WorldPlan.lua	Wed Feb 08 13:11:07 2017 -0500
+++ b/WorldPlan.lua	Sat Feb 11 14:25:57 2017 -0500
@@ -50,7 +50,7 @@
     numberFontObject = 'WorldPlanFont'
   },
   zone = {
-    iconWidth = 22,
+    iconWidth = 18,
     borderWidth = 2,
     highlightWidth = 2,
     TagSize = 12,
--- a/WorldPlan.xml	Wed Feb 08 13:11:07 2017 -0500
+++ b/WorldPlan.xml	Sat Feb 11 14:25:57 2017 -0500
@@ -56,12 +56,12 @@
     </Animations>
     <Layers>
       <Layer level="BACKGROUND" textureSubLevel="-2">
-        <Texture parentKey="HighlightBorder" desaturated="true">
+        <Texture parentKey="HighlightBorder"  file="Interface\UNITPOWERBARALT\Generic1Target_Circular_Frame" desaturated="true">
           <Anchors>
             <Anchor point="CENTER" />
           </Anchors>
         </Texture>
-        <Texture parentKey="EliteBorder" atlas="worldquest-questmarker-dragon" useAtlasSize="true" hidden="true">
+        <Texture parentKey="EliteBorder"  atlas="worldquest-questmarker-dragon" useAtlasSize="true" hidden="true">
           <Anchors>
             <Anchor point="TOPRIGHT" x="6" y="6" />
             <Anchor point="BOTTOMLEFT" x="-6" y="-6" />
@@ -74,12 +74,6 @@
             <Anchor point="CENTER" />
           </Anchors>
         </Texture>
-        <Texture parentKey="MouseGlow" file="Interface\UNITPOWERBARALT\Generic1Target_Circular_Frame" alphaMode="ADD" hidden="true">
-          <Anchors>
-            <Anchor point="BOTTOMLEFT" x="-2" y="-2" />
-            <Anchor point="TOPRIGHT" x="2" y="2" />
-          </Anchors>
-        </Texture>
       </Layer>
       <Layer level="BORDER">
         <Texture parentKey="icon" setAllPoints="true">
@@ -105,10 +99,10 @@
         </Texture>
       </Layer>
       <Layer level="HIGHLIGHT">
-        <Texture parentKey="highlight" alphaMode="ADD" alpha="0" file="Interface\Tooltips\UI-Tooltip-Background" desaturated="true">
+        <Texture parentKey="highlight" alphaMode="ADD" alpha="1" file="Interface\UNITPOWERBARALT\Generic1Target_Circular_Frame" desaturated="true">
           <Anchors>
-            <Anchor point="BOTTOMLEFT" x="-3" y="-3" />
-            <Anchor point="TOPRIGHT" x="3" y="3" />
+            <Anchor point="BOTTOMLEFT" />
+            <Anchor point="TOPRIGHT" />
           </Anchors>
         </Texture>
 
--- a/WorldQuests.lua	Wed Feb 08 13:11:07 2017 -0500
+++ b/WorldQuests.lua	Sat Feb 11 14:25:57 2017 -0500
@@ -89,10 +89,10 @@
   end
 end
 
-function Module:OnUpdateQuestBonusObjectives()
-  print('|cFFFF4400WorldMap_UpdateQuestBonusObjectives')
+local SpellCanTargetQuest = SpellCanTargetQuest
+function Module:UpdateBlizzButtons()
+
   local func = SpellCanTargetQuest() and InternalShowButton or InternalHideButton
-  print(SpellCanTargetQuest())
   for i = 1, NUM_WORLDMAP_TASK_POIS do
     local button = _G['WorldMapFrameTaskPOI'..i]
     if button and button.worldQuest then
@@ -101,9 +101,13 @@
   end
 end
 
+function Module:OnUpdateQuestBonusObjectives()
+  print('|cFFFF4400WorldMap_UpdateQuestBonusObjectives')
+  self:UpdateBlizzButtons()
+end
+
 function Module:OnClickWorldMapActionButton()
-  self.IsTargeting = SpellCanTargetQuest()
-  self:OnUpdateQuestBonusObjectives()
+  self:UpdateBlizzButtons()
 end
 
 local defaults = {}
@@ -130,6 +134,7 @@
   self:RegisterEvent('WORLD_QUEST_COMPLETED_BY_SPELL')
   self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
   self:RegisterEvent('SKILL_LINES_CHANGED')
+  self:RegisterEvent('CURRENT_SPELL_CAST_CHANGED')
 end
 
 function Module:OnMapInfo(isBrokenIsle, isZoomedOut, mapAreaID)
@@ -160,7 +165,7 @@
       questPOI.isStale = true
       self.isStale = true
     else
-      self:Refresh(true)
+      self:Refresh()
     end
     print('WorldMapFrame', WorldMapFrame:IsVisible(), 'hasUpdates:', self.isStale)
   elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then
@@ -170,14 +175,19 @@
       rprint('|cFFFF4400release|r', questID)
     end
   elseif event == 'SKILL_LINES_CHANGED' then
-    self:Refresh(true)
+    self:Refresh()
+  elseif event == 'CURRENT_SPELL_CAST_CHANGED' then
+
+    self:Refresh()
   elseif event == 'ARTIFACT_UPDATE' then
     local ak = C_ArtifactUI.GetArtifactKnowledgeMultiplier()
     if ak and (ak ~= self.akLevel) then
+      print('push artifact knowledge update', self.akLevel, 'to', ak)
       self.akLevel = ak
-      self.ArtifactPowerDirty = true
-      -- artifact knowledge changed
-      self:Refresh(true)
+      for index, pin in pairs( db.QuestsByID) do
+        pin.dataLoaded = nil
+      end
+      self:Refresh()
     end
   end
 end
@@ -235,7 +245,7 @@
     end
   end
 
-  if (not pin.dataLoaded) or self.ArtifactPowerDirty then
+  if (not pin.dataLoaded) then
     pin:GetData()
   end
 
@@ -259,9 +269,7 @@
     end
     db.TasksByID[id] = nil
   end
-  pin:SetShown(false)
-  pin.Overlay:SetShown(false)
-  pin.timeLabel:SetShown(false)
+  pin:HideFrames()
   tinsert(db.FreePins, pin)
 
   print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title)
@@ -448,8 +456,11 @@
     pin.used = nil
   end
 
-  self:UpdateAnchors(nil)
-
+  if SpellCanTargetQuest() then
+    self:UpdateBlizzButtons()
+  else
+    self:UpdateAnchors(nil)
+  end
 
   print('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
   rprint('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
@@ -466,14 +477,12 @@
       if oV == true then
         print('|cFFFF4400 -|r', questID, pin.title)
       end
-      pin:SetShown(false)
+      pin:HideFrames()
     end
   end
 
   self.isStale = nil
   self.sizesDirty = nil
-
-  self.ArtifactPowerDirty = nil
 end
 
 -- update visibility states of all pins
@@ -539,6 +548,7 @@
     return
   end
 
+
   numPins = 0
   local taskInfo = TQ_GetQuestsForPlayerByMapID(self.currentMapID)
   if taskInfo then