Quantcast

Fixing an issue with creating waypoints via the world map

James Whitehead II [04-15-09 - 20:41]
Fixing an issue with creating waypoints via the world map
Filename
TomTom.lua
TomTom.toc
diff --git a/TomTom.lua b/TomTom.lua
index e3997fa..81aa77b 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -322,20 +322,20 @@ function TomTom:ShowHideCoordBlock()
 end

 -- Hook the WorldMap OnClick
-local Orig_WorldMapButton_OnClick = WorldMapButton_OnClick
 local world_click_verify = {
 	["A"] = function() return IsAltKeyDown() end,
 	["C"] = function() return IsControlKeyDown() end,
 	["S"] = function() return IsShiftKeyDown() end,
 }

-function WorldMapButton_OnClick(self, ...)
+local origScript = WorldMapButton:GetScript("OnMouseUp")
+WorldMapButton:SetScript("OnMouseUp", function(self, ...)
 	local mouseButton, button = ...
 	if mouseButton == "RightButton" then
 		-- Check for all the modifiers that are currently set
 		for mod in TomTom.db.profile.worldmap.create_modifier:gmatch("[ACS]") do
 			if not world_click_verify[mod] or not world_click_verify[mod]() then
-				return Orig_WorldMapButton_OnClick(self, ...)
+                return origScript and origScript(self, ...) or true
 			end
 		end

@@ -344,17 +344,14 @@ function WorldMapButton_OnClick(self, ...)
 		local x,y = GetCurrentCursorPosition()

 		if z == 0 then
-			return Orig_WorldMapButton_OnClick(self, ...)
+			return origScript and origScript(self, ...) or true
 		end

 		local uid = TomTom:AddZWaypoint(c,z,x*100,y*100)
 	else
-		return Orig_WorldMapButton_OnClick(self, ...)
+		return origScript and origScript(self, ...) or true
 	end
-end
-
-local oldText = WorldMapMagnifyingGlassButton:GetText()
-WorldMapMagnifyingGlassButton:SetText(oldText .. "\n" .. L["Ctrl+Right Click To Add a Waypoint"])
+end)

 local function WaypointCallback(event, arg1, arg2, arg3)
 	if event == "OnDistanceArrive" then
diff --git a/TomTom.toc b/TomTom.toc
index d242023..1f6296e 100755
--- a/TomTom.toc
+++ b/TomTom.toc
@@ -1,5 +1,6 @@
-## Interface: 30000
+## Interface: 30100
 ## Title: TomTom
+## Author: jnwhiteh
 ## Version: wowi:revision
 ## Notes: Acts as your portable navigation assistant
 ## Notes-zhCN:一个简单的导航助手。