Quantcast

New option for minimap coords

Darthpred [02-23-13 - 17:14]
New option for minimap coords
Filename
ElvUI_SLE/config/profile.lua
ElvUI_SLE/locales/english.lua
ElvUI_SLE/locales/russian.lua
ElvUI_SLE/modules/minimap/minimapcoords.lua
ElvUI_SLE/modules/minimap/options.lua
diff --git a/ElvUI_SLE/config/profile.lua b/ElvUI_SLE/config/profile.lua
index e75677f..0638adc 100644
--- a/ElvUI_SLE/config/profile.lua
+++ b/ElvUI_SLE/config/profile.lua
@@ -156,6 +156,7 @@ P['sle'] = {
 		['enable'] = false,
 		['coords'] = {
 			['display'] = "SHOW",
+			['middle'] = false,
 		},
 		['buttons'] = {
 			['anchor'] = "NOANCHOR",
diff --git a/ElvUI_SLE/locales/english.lua b/ElvUI_SLE/locales/english.lua
index 2abf3a4..2b17443 100644
--- a/ElvUI_SLE/locales/english.lua
+++ b/ElvUI_SLE/locales/english.lua
@@ -171,6 +171,8 @@ L['MINIMAP_DESC'] = "These options effect various aspects of the minimap.  Some
 L["Minimap Coordinates"] = true
 L['Coords Display'] = true
 L['Change settings for the display of the coordinates that are on the minimap.'] = true
+L["Coords in the middle"] = true
+L['If enabled will show coordinates in the center of minimaps lower border. Otherwise in the lower corners.'] = true
 L["Minimap Buttons"] = true
 L['Enable/Disable minimap button skinning.'] = true
 L['Anchor Setting'] = true
diff --git a/ElvUI_SLE/locales/russian.lua b/ElvUI_SLE/locales/russian.lua
index fcf67d7..9e3a1eb 100644
--- a/ElvUI_SLE/locales/russian.lua
+++ b/ElvUI_SLE/locales/russian.lua
@@ -170,6 +170,8 @@ L['MINIMAP_DESC'] = "Эти опции влияют на различные фу
 L["Minimap Coordinates"] = "Координаты на миникарте"
 L['Coords Display'] = "Отображение координат"
 L['Change settings for the display of the coordinates that are on the minimap.'] = "Укажите условие отображения координат на миникарте."
+L["Coords in the middle"] = "Координаты посередине"
+L['If enabled will show coordinates in the center of minimaps lower border. Otherwise in the lower corners.'] = "Если аткивно, будет отображать координаты внизу миникарты по центру. В противном случае, в нижних углах."
 L["Minimap Buttons"] = "Иконки у миникарты"
 L['Enable/Disable minimap button skinning.'] = "Включить/выключить стилизацию иконок у миникарты."
 L['Anchor Setting'] = "Настрокий расположения"
diff --git a/ElvUI_SLE/modules/minimap/minimapcoords.lua b/ElvUI_SLE/modules/minimap/minimapcoords.lua
index 79268b9..f72a674 100644
--- a/ElvUI_SLE/modules/minimap/minimapcoords.lua
+++ b/ElvUI_SLE/modules/minimap/minimapcoords.lua
@@ -4,36 +4,50 @@ local M = E:GetModule('Minimap')
 local GetPlayerMapPosition = GetPlayerMapPosition
 local framescreated = false
 local panel, xpos, ypos
+local middle

 local function UpdateCoords(self, elapsed)
 	panel.elapsed = (panel.elapsed or 0) + elapsed
 	if panel.elapsed < .1 then return end

 	xpos.pos, ypos.pos = GetPlayerMapPosition('player')
-	xpos.text:SetFormattedText('%.2f', xpos.pos * 100)
+	xpos.text:SetFormattedText(E.db.sle.minimap.middle and '%.2f/' or '%.2f', xpos.pos * 100)
 	ypos.text:SetFormattedText('%.2f', ypos.pos * 100)

 	panel.elapsed = 0
 end

-local function CreateCoordsFrame()
+local function UpdatePosition(middle)
+	xpos:ClearAllPoints()
+	ypos:ClearAllPoints()
+	if middle then
+		xpos:Point('BOTTOMRIGHT', panel, 'BOTTOM',10, 0)
+	else
+		xpos:Point('LEFT', panel, 'LEFT', 2, 0)
+	end
+	if middle then
+		ypos:Point('BOTTOMLEFT', panel, 'BOTTOM', 0, 0)
+	else
+		ypos:Point('RIGHT', panel, 'RIGHT', 2, 0)
+	end
+end
+
+local function CreateCoordsFrame(middle)
 	panel = CreateFrame('Frame', 'EnhancedLocationPanel', E.UIParent)
 	panel:SetFrameStrata("MEDIUM")
 	panel:Point("CENTER", Minimap, "CENTER", 0, 0)
 	panel:Size(E.MinimapSize, 22)

 	xpos = CreateFrame('Frame', "MapCoordinatesX", panel)
-	xpos:Point('LEFT', panel, 'LEFT', 2, 0)
 	xpos:Size(40, 22)
-
+
 	xpos.text = xpos:CreateFontString(nil, "OVERLAY")
 	xpos.text:FontTemplate(E.media.font, 12, "OUTLINE")
 	xpos.text:SetAllPoints(xpos)

 	ypos = CreateFrame('Frame', "MapCoordinatesY", panel)
-	ypos:Point('RIGHT', panel, 'RIGHT', -2, 0)
 	ypos:Size(40, 22)
-
+
 	ypos.text = ypos:CreateFontString(nil, "OVERLAY")
 	ypos.text:FontTemplate(E.media.font, 12, "OUTLINE")
 	ypos.text:SetAllPoints(ypos)
@@ -47,19 +61,23 @@ local function CreateCoordsFrame()
 		panel:Hide()
 	end)
 	framescreated = true
+
+	UpdatePosition(middle)
 end

 M.UpdateSettingsSLE = M.UpdateSettings
 function M:UpdateSettings()
 	M.UpdateSettingsSLE(self)
+	middle = E.db.sle.minimap.middle

 	if not framescreated then
-		CreateCoordsFrame()
+		CreateCoordsFrame(middle)
 	end

 	panel:SetPoint('BOTTOM', Minimap, 'BOTTOM', 0, -(E.PixelMode and 1 or 2))
 	panel:Size(E.MinimapSize, 22)
 	panel:SetScript('OnUpdate', UpdateCoords)
+	UpdatePosition(middle)
 	if E.db.sle.minimap.coords.display ~= 'SHOW' or not E.private.general.minimap.enable or not E.db.sle.minimap.enable then
 		panel:Hide()
 	else
diff --git a/ElvUI_SLE/modules/minimap/options.lua b/ElvUI_SLE/modules/minimap/options.lua
index d15ee1a..1d42f45 100644
--- a/ElvUI_SLE/modules/minimap/options.lua
+++ b/ElvUI_SLE/modules/minimap/options.lua
@@ -43,6 +43,15 @@ local function configTable()
 						},
 						disabled = function() return not E.db.sle.minimap.enable end,
 					},
+					middle = {
+						order = 3,
+						type = "toggle",
+						name = L["Coords in the middle"],
+						desc = L['If enabled will show coordinates in the center of minimaps lower border. Otherwise in the lower corners.'],
+						disabled = function() return not E.db.sle.minimap.enable end,
+						get = function(info) return E.db.sle.minimap.middle end,
+						set = function(info, value) E.db.sle.minimap.middle = value; E:GetModule('Minimap'):UpdateSettings() end,
+					},
 				},
 			},
 			buttons = {