Skip to content

Commit

Permalink
Merge pull request #216 from Grimsbain/master
Browse files Browse the repository at this point in the history
Fix for map coords in restricted areas.
  • Loading branch information
Peter Renström authored Oct 26, 2016
2 parents f27bd1d + c00d843 commit fb77378
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions Interface/AddOns/nCore/modules/coords.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,23 @@ f:SetScript('OnUpdate', function(self, elapsed)
local px, py = GetPlayerMapPosition('player')
local cx, cy = GetCursorPosition()

mx = ((cx / WorldMapDetailFrame:GetEffectiveScale()) - (mx - width / 2)) / width
my = ((my + height / 2) - (cy / WorldMapDetailFrame:GetEffectiveScale())) / height
if (px) then
mx = ((cx / WorldMapDetailFrame:GetEffectiveScale()) - (mx - width / 2)) / width
my = ((my + height / 2) - (cy / WorldMapDetailFrame:GetEffectiveScale())) / height

if (mx >= 0 and my >= 0 and mx <= 1 and my <= 1) then
f.Cursor:SetText(MOUSE_LABEL..format(': %.0f x %.0f', mx * 100, my * 100))
else
f.Cursor:SetText('')
end
if (mx >= 0 and my >= 0 and mx <= 1 and my <= 1) then
f.Cursor:SetText(MOUSE_LABEL..format(': %.0f x %.0f', mx * 100, my * 100))
else
f.Cursor:SetText('')
end

if (px ~= 0 and py ~= 0) then
f.Player:SetText(PLAYER..format(': %.0f x %.0f', px * 100, py * 100))
if (px ~= 0 and py ~= 0) then
f.Player:SetText(PLAYER..format(': %.0f x %.0f', px * 100, py * 100))
else
f.Player:SetText('')
end
else
f.Cursor:SetText('')
f.Player:SetText('')
end
end)

0 comments on commit fb77378

Please sign in to comment.