Quantcast

loc panel new optino. This closes #240

Darthpred [07-31-16 - 13:47]
loc panel new optino. This closes #240
Filename
ElvUI_SLE/modules/minimap/locationbar.lua
ElvUI_SLE/options/minimap/locpanel_c.lua
diff --git a/ElvUI_SLE/modules/minimap/locationbar.lua b/ElvUI_SLE/modules/minimap/locationbar.lua
index 3f5aaf9..36c5f81 100644
--- a/ElvUI_SLE/modules/minimap/locationbar.lua
+++ b/ElvUI_SLE/modules/minimap/locationbar.lua
@@ -226,6 +226,7 @@ function LP:UpdateCoords(elapsed)
 		displayLine = subZoneText
 	end
 	loc_panel.Text:SetText(displayLine)
+	if LP.db.autowidth then loc_panel:Width(loc_panel.Text:GetStringWidth() + 10) end

 	--Location Colorings
 	if displayLine ~= "" then
@@ -248,7 +249,11 @@ function LP:UpdateCoords(elapsed)
 end

 function LP:Resize()
-	loc_panel:Size(LP.db.width, LP.db.height)
+	if LP.db.autowidth then
+		loc_panel:Size(loc_panel.Text:GetStringWidth() + 10, LP.db.height)
+	else
+		loc_panel:Size(LP.db.width, LP.db.height)
+	end
 	loc_panel.Text:Width(LP.db.width - 18)
 	loc_panel.Xcoord:Size(LP.db.fontSize * 3, LP.db.height)
 	loc_panel.Ycoord:Size(LP.db.fontSize * 3, LP.db.height)
diff --git a/ElvUI_SLE/options/minimap/locpanel_c.lua b/ElvUI_SLE/options/minimap/locpanel_c.lua
index e087a7a..6c4ecd1 100644
--- a/ElvUI_SLE/options/minimap/locpanel_c.lua
+++ b/ElvUI_SLE/options/minimap/locpanel_c.lua
@@ -20,11 +20,18 @@ local function configTable()
 				type = 'range',
 				name = L["Width"],
 				min = 100, max = E.screenwidth/2, step = 1,
-				disabled = function() return not E.db.sle.minimap.locPanel.enable end,
+				disabled = function() return not E.db.sle.minimap.locPanel.enable or E.db.sle.minimap.locPanel.autowidth end,
 				set = function(info, value) E.db.sle.minimap.locPanel[ info[#info] ] = value; LP:Resize() end,
 			},
-			height = {
+			autowidth = {
+				type = "toggle",
+				name = L["Automatic Width"],
+				desc = L["Change width based on the zone name length."],
 				order = 3,
+				set = function(info, value) E.db.sle.minimap.locPanel[ info[#info] ] = value; LP:Resize() end,
+			},
+			height = {
+				order = 4,
 				type = 'range',
 				name = L["Height"],
 				min = 10, max = 50, step = 1,
@@ -32,7 +39,7 @@ local function configTable()
 				set = function(info, value) E.db.sle.minimap.locPanel[ info[#info] ] = value; LP:Resize() end,
 			},
 			template = {
-				order = 4,
+				order = 5,
 				name = L["Template"],
 				type = "select",
 				disabled = function() return not E.db.sle.minimap.locPanel.enable end,
@@ -43,7 +50,7 @@ local function configTable()
 				},
 			},
 			throttle = {
-				order = 5,
+				order = 6,
 				type = 'range',
 				name = L["Update Throttle"],
 				desc = L["The frequency of coordinates and zonetext updates. Check will be done more often with lower values."],
@@ -52,7 +59,7 @@ local function configTable()
 				set = function(info, value) E.db.sle.minimap.locPanel[ info[#info] ] = value; end,
 			},
 			format = {
-				order = 6,
+				order = 7,
 				name = L["Format"],
 				type = "select",
 				disabled = function() return not E.db.sle.minimap.locPanel.enable end,
@@ -66,12 +73,12 @@ local function configTable()
 			zoneText = {
 				type = "toggle",
 				name = L["Full Location"],
-				order = 7,
+				order = 8,
 				disabled = function() return not E.db.sle.minimap.locPanel.enable end,
 				set = function(info, value) E.db.sle.minimap.locPanel[ info[#info] ] = value; end,
 			},
 			colorType = {
-				order = 8,
+				order = 9,
 				name = L["Color Type"],
 				type = "select",
 				disabled = function() return not E.db.sle.minimap.locPanel.enable end,
@@ -84,7 +91,7 @@ local function configTable()
 			},
 			customColor = {
 				type = 'color',
-				order = 9,
+				order = 10,
 				name = L["Custom Color"],
 				disabled = function() return not E.db.sle.minimap.locPanel.enable or not E.db.sle.minimap.locPanel.colorType == "CUSTOM" end,
 				get = function(info)
@@ -102,11 +109,11 @@ local function configTable()
 				type = "toggle",
 				name = L["Link Position"],
 				desc = L["Allow pasting of your coordinates in chat editbox via holding shift and clicking on the location name."],
-				order = 10,
+				order = 11,
 				set = function(info, value) E.db.sle.minimap.locPanel[ info[#info] ] = value; end,
 			},
 			portals = {
-				order = 11,
+				order = 12,
 				type = "group",
 				name = L["Relocation Menu"],
 				guiInline = true,
@@ -155,7 +162,7 @@ local function configTable()
 				},
 			},
 			fontGroup = {
-				order = 12,
+				order = 13,
 				type = "group",
 				name = L["Fonts"],
 				guiInline = true,