WoWInterface SVN zz_Coords

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 82 to Rev 83
    Reverse comparison

Rev 82 → Rev 83

trunk/zz_Coords/core.lua
35,21 → 35,10
end
return info
end
function addon:setOldPlayerCoords()
local x,y = GetPlayerMapPosition("player")
if(x) then
if(y) then
playerCoords = format("%.1f, %.1f", x*100, y*100)
end
end
end
function addon:GetOldPlayerCoords()
function addon:GetPlayerCoords()
return playerCoords
end
local function setPlayerCoords(mapID,x,y)
if(not C_Map) then
return addon:setOldPlayerCoords()
end
playerCoords = "-, -"
mapID = C_Map.GetBestMapForUnit("player")
if(mapID) then
trunk/zz_Coords/provider.lua
16,32 → 16,6
local adjustedY = y * 100
return adjustedX,adjustedY
end
local function update2()
if(not addon['db']['profile'][childName]) then return end
if(not db) then
db = addon['db']['profile'][childName]
end
if(coordText) then
addon:setOldPlayerCoords()
local x, y = GetCursorPosition();
x = x / WorldMapButton:GetEffectiveScale();
y = y / WorldMapButton:GetEffectiveScale();
 
local centerX, centerY = WorldMapButton:GetCenter();
local width = WorldMapButton:GetWidth();
local height = WorldMapButton:GetHeight();
local adjustedY = addon:round((centerY + (height/2) - y) / height * 100,1);
local adjustedX = addon:round((x - (centerX - (width/2))) / width * 100,1);
coordText:SetText(format("Mouse: %i, %i Player: %s",adjustedX,adjustedY,addon:GetOldPlayerCoords()))
if(not db['hideMapCoords']) then
mapframe:SetWidth(coordText:GetStringWidth()+4)
mapframe:SetPoint("BOTTOMLEFT", WorldMapButton, "BOTTOMLEFT", db['windowX'], db['windowY'])
mapframe:Show()
else
mapframe:Hide()
end
end
end
local function update()
if(not addon['db']['profile'][childName]) then return end
if(not db) then
86,7 → 60,7
-- Optionally override in your mixin, called when this provider is added to a map canvas
self.owningMap = owningMap;
if(not coordText or not mapframe) then
mapframe = CreateFrame("Frame", "zz_CoordsMapFrame", C_Map and WorldMapFrame or WorldMapButton)
mapframe = CreateFrame("Frame", "zz_CoordsMapFrame", WorldMapFrame)
mapframe:SetWidth(600)
mapframe:SetHeight(20)
-- mapframe:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOMLEFT", addon['db']['windowX'], addon['db']['windowY'])
114,11 → 88,7
self.elapsed = self.elapsed + elapsed
if(self.elapsed<0.2) then return end
self.elapsed = 0
if(C_Map) then
update()
else
update2()
end
update()
end)
addon['mapframe'] = mapframe
end