WoWInterface SVN zz_Coords

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 77 to Rev 78
    Reverse comparison

Rev 77 → Rev 78

trunk/zz_Coords/core.lua
35,7 → 35,21
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()
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
10,14 → 10,38
function zzDataProvider:GetMap()
return self.owningMap;
end
local function GetXY()
local map = WorldMapFrame.ScrollContainer
local x, y = map:GetNormalizedCursorPosition();
function addon:GetXY()
local x, y = WorldMapFrame.ScrollContainer:GetNormalizedCursorPosition();
local adjustedX = x * 100
local adjustedY = y * 100
return adjustedX,adjustedY
end
addon['GetXY'] = GetXY
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
28,7 → 52,7
db['screenY'] = db['screenY'] or 5
db['windowX'] = db['windowX'] or 10
db['windowY'] = db['windowY'] or 5
local x,y = GetXY()
local x,y = addon:GetXY()
local str = ""
local mapID = zzDataProvider:GetMap():GetMapID()
if(mapID and db['ShowMapID']) then
58,7 → 82,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", WorldMapFrame)
mapframe = CreateFrame("Frame", "zz_CoordsMapFrame", C_Map and WorldMapFrame or WorldMapButton)
mapframe:SetWidth(600)
mapframe:SetHeight(20)
-- mapframe:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOMLEFT", addon['db']['windowX'], addon['db']['windowY'])
86,7 → 110,11
self.elapsed = self.elapsed + elapsed
if(self.elapsed<0.2) then return end
self.elapsed = 0
update()
if(C_Map) then
update()
else
update2()
end
end)
addon['mapframe'] = mapframe
end
187,5 → 215,8
self:OnEvent(event, ...);
end
end
 
WorldMapFrame:AddDataProvider(zzDataProvider)
\ No newline at end of file +if(type(WorldMapFrame.AddDataProvider) == 'function') then + WorldMapFrame:AddDataProvider(zzDataProvider) +else + zzDataProvider:OnAdded() +end \ No newline at end of file