Quantcast

Minimap coordinates decimals

Darthpred [08-20-14 - 05:29]
Minimap coordinates decimals
Filename
ElvUI_SLE/defaults/profile.lua
ElvUI_SLE/modules/minimap/minimapcoords.lua
ElvUI_SLE/options/minimap_c.lua
diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua
index 6fdc59c..1c504d2 100644
--- a/ElvUI_SLE/defaults/profile.lua
+++ b/ElvUI_SLE/defaults/profile.lua
@@ -320,6 +320,7 @@ P['sle'] = {
 		['coords'] = {
 			['display'] = "SHOW",
 			['middle'] = "CORNERS",
+			['decimals'] = true,
 		},
 		['buttons'] = {
 			['anchor'] = "NOANCHOR",
diff --git a/ElvUI_SLE/modules/minimap/minimapcoords.lua b/ElvUI_SLE/modules/minimap/minimapcoords.lua
index 4a0bb3c..59cad1e 100644
--- a/ElvUI_SLE/modules/minimap/minimapcoords.lua
+++ b/ElvUI_SLE/modules/minimap/minimapcoords.lua
@@ -19,12 +19,13 @@ local function ShowMinimap()
 end

 local function UpdateCoords(self, elapsed)
+	local f = E.db.sle.minimap.coords.decimals and '%.2f' or '%.0f'
 	panel.elapsed = (panel.elapsed or 0) + elapsed
 	if panel.elapsed < .1 then return end

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

 	panel.elapsed = 0
 end
@@ -48,7 +49,7 @@ local function UpdatePosition(middle)
 		xpos:Point('LEFT', panel, 'LEFT', 2, 0)
 	end
 	if middle == "CENTER" then
-		ypos:Point('BOTTOMLEFT', panel, 'BOTTOM', 0, 0)
+		ypos:Point('BOTTOMLEFT', panel, 'BOTTOM', E.db.sle.minimap.coords.decimals and 0 or -15, 0)
 	else
 		ypos:Point('RIGHT', panel, 'RIGHT', 2, 0)
 	end
diff --git a/ElvUI_SLE/options/minimap_c.lua b/ElvUI_SLE/options/minimap_c.lua
index 0c55118..6308474 100644
--- a/ElvUI_SLE/options/minimap_c.lua
+++ b/ElvUI_SLE/options/minimap_c.lua
@@ -74,6 +74,15 @@ local function configTable()
 							['CENTER'] = L['Bottom Center'],
 						},
 					},
+					decimals = {
+						type = "toggle",
+						name = L['Decimals'],
+						order = 4,
+						--desc = L['Enable/Disable Square Minimap Coords.'],
+						get = function(info) return E.db.sle.minimap.coords.decimals end,
+						set = function(info, value) E.db.sle.minimap.coords.decimals = value; E:GetModule('Minimap'):UpdateSettings() end,
+						disabled = function() return not E.private.general.minimap.enable end,
+					},
 				},
 			},
 			mapicons = {