Quantcast

Hide the crazy arrow feed frame when no waypoint

James Whitehead II [11-04-12 - 10:03]
Hide the crazy arrow feed frame when no waypoint

This prevents excessive calls when there is no waypoint being displayed.
Filename
TomTom_CrazyArrow.lua
diff --git a/TomTom_CrazyArrow.lua b/TomTom_CrazyArrow.lua
index dbe5e61..a6c8349 100755
--- a/TomTom_CrazyArrow.lua
+++ b/TomTom_CrazyArrow.lua
@@ -95,6 +95,7 @@ function TomTom:SetCrazyArrow(uid, dist, title)
 	if self.profile.arrow.enable then
 		wayframe.title:SetText(title or L["Unknown waypoint"])
 		wayframe:Show()
+		wayframe.crazyFeedFrame:Show()
 	end
 end

@@ -435,6 +436,7 @@ local function wayframe_OnEvent(self, event, arg1, ...)
 				throttle = TomTom.db.profile.feeds.arrow_throttle
 			end

+			wayframe.crazyFeedFrame = crazyFeedFrame
 			crazyFeedFrame:SetScript("OnUpdate", function(self, elapsed)
 				counter = counter + elapsed
 				if counter < throttle then
@@ -442,7 +444,9 @@ local function wayframe_OnEvent(self, event, arg1, ...)
 				end

 				counter = 0
-
+				if not active_point then
+					self:Hide()
+				end
 				local angle = TomTom:GetDirectionToWaypoint(active_point)
 				local player = GetPlayerFacing()
 				if not angle or not player then