c2e174c - Update OmaCoords to 8.0
[wowui.git] / OmaCoords / Coords.lua
index 7a50559..fd358a1 100644 (file)
@@ -3,26 +3,23 @@ local _;
 local CTimerAfter = C_Timer.After;
 
 local updating = false;
 local CTimerAfter = C_Timer.After;
 
 local updating = false;
-local zoneChanged = true;
-
 local frame = CreateFrame("Frame", "OmaCoords", UIParent);
 frame:SetPoint("CENTER", UIParent, "CENTER", 0, 60);
 frame:SetWidth(1);
 frame:SetHeight(1);
 frame.text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
 frame.text:SetPoint("CENTER");
 local frame = CreateFrame("Frame", "OmaCoords", UIParent);
 frame:SetPoint("CENTER", UIParent, "CENTER", 0, 60);
 frame:SetWidth(1);
 frame:SetHeight(1);
 frame.text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
 frame.text:SetPoint("CENTER");
-frame:SetScript("OnEvent", function() zoneChanged = true end);
-frame:RegisterEvent("ZONE_CHANGED_NEW_AREA");
 frame:Hide();
 
 local function update()
     if updating then
 frame:Hide();
 
 local function update()
     if updating then
-        if zoneChanged then
-            SetMapToCurrentZone();
-            zoneChanged = false;
+        local vec = C_Map.GetPlayerMapPosition(C_Map.GetBestMapForUnit("player"), "player");
+        if vec then
+            local x, y = vec:GetXY();
+            frame.text:SetFormattedText("%.1f, %.1f", x*100, y*100);
+        else
+            frame.text:SetFormattedText("not available");
         end
         end
-        local x, y = GetPlayerMapPosition("player");
-        frame.text:SetFormattedText("%.1f, %.1f", (x or 0)*100, (y or 0)*100);
         CTimerAfter(0.2, update);
     end
 end
         CTimerAfter(0.2, update);
     end
 end