View Single Post
06-17-18, 12:40 PM   #4
siweia
A Flamescale Wyrmkin
 
siweia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 126
Code:
	local mapID, position
	local formatText = ": %.1f, %.1f"

	hooksecurefunc(WorldMapFrame, "OnMapChanged", function(self)
		mapID = self:GetMapID()
	end)

	local function CoordsUpdate(player, cursor)
		local cx, cy = CursorCoords()
		if cx and cy then
			cursor:SetFormattedText(MOUSE_LABEL..formatText, 100 * cx, 100 * cy)
		else
			cursor:SetText(MOUSE_LABEL..": --, --")
		end

		position = C_Map.GetPlayerMapPosition(mapID, "player")
		if not position or (position.x == 0 and position.y == 0) then
			player:SetText(PLAYER..": --, --")
		else
			player:SetFormattedText(PLAYER..formatText, 100 * position.x, 100 * position.y)
			wipe(position)
		end
	end
  Reply With Quote