Quantcast

Add default_iconsize controls for world and mini map.

Ludovicus [07-20-19 - 17:49]
Add default_iconsize controls for world and mini map.
Filename
TomTom.lua
TomTom_Config.lua
TomTom_Waypoints.lua
diff --git a/TomTom.lua b/TomTom.lua
index ea672cf..1517f66 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -84,6 +84,7 @@ function TomTom:Initialize(event, addon)
                 otherzone = true,
                 tooltip = true,
                 menu = true,
+                default_iconsize = 16,
             },
             worldmap = {
                 enable = true,
@@ -92,6 +93,7 @@ function TomTom:Initialize(event, addon)
                 clickcreate = true,
                 menu = true,
                 create_modifier = "C",
+                default_iconsize = 16,
             },
             comm = {
                 enable = true,
diff --git a/TomTom_Config.lua b/TomTom_Config.lua
index 8c93b21..09f9a6d 100755
--- a/TomTom_Config.lua
+++ b/TomTom_Config.lua
@@ -438,6 +438,13 @@ local function createconfig()
 				width = "double",
 				arg = "minimap.menu",
 			},
+			iconsize = {
+				type = "range",
+				name = L["Minimap Icon Size"],
+				desc = L["This setting allows you to control the default size of the minimap icon. "],
+				min = 4, max = 64, step = 2,
+				arg = "minimap.default_iconsize",
+			},
 		},
 	} -- End minimap options

@@ -571,6 +578,14 @@ local function createconfig()

 				},
 			},
+			iconsize = {
+				order = 10,
+				type = "range",
+				name = L["World Map Icon Size"],
+				desc = L["This setting allows you to control the default size of the world map icon"],
+				min = 4, max = 64, step = 2,
+				arg = "worldmap.default_iconsize",
+			},
 		},
 	} -- End world map options

diff --git a/TomTom_Waypoints.lua b/TomTom_Waypoints.lua
index ce46f62..8001096 100755
--- a/TomTom_Waypoints.lua
+++ b/TomTom_Waypoints.lua
@@ -70,6 +70,7 @@ local waypointMap = {}

 function TomTom:SetWaypoint(waypoint, callbacks, show_minimap, show_world)
     local m, x, y = unpack(waypoint)
+    local profile = self.profile

     -- Try to acquire a waypoint from the frame pool
     local point = table.remove(pool)
@@ -142,8 +143,8 @@ function TomTom:SetWaypoint(waypoint, callbacks, show_minimap, show_world)
     else
         point.minimap.icon:SetTexture(waypoint.minimap_icon or "Interface\\AddOns\\TomTom\\Images\\GoldGreenDot")
     end
-    point.minimap.icon:SetHeight(waypoint.minimap_icon_size or 16)
-    point.minimap.icon:SetWidth(waypoint.minimap_icon_size or 16)
+    point.minimap.icon:SetHeight(waypoint.minimap_icon_size or profile.minimap.default_iconsize)
+    point.minimap.icon:SetWidth(waypoint.minimap_icon_size or profile.minimap.default_iconsize)

     -- Set up the worldmap.icon
     if waypoint.worldmap_displayID then
@@ -151,8 +152,8 @@ function TomTom:SetWaypoint(waypoint, callbacks, show_minimap, show_world)
     else
         point.worldmap.icon:SetTexture(waypoint.worldmap_icon or "Interface\\AddOns\\TomTom\\Images\\GoldGreenDot")
     end
-    point.worldmap:SetHeight(waypoint.worldmap_icon_size or 16)
-    point.worldmap:SetWidth(waypoint.worldmap_icon_size or 16)
+    point.worldmap:SetHeight(waypoint.worldmap_icon_size or profile.worldmap.default_iconsize)
+    point.worldmap:SetWidth(waypoint.worldmap_icon_size or profile.worldmap.default_iconsize)

     -- Process the callbacks table to put distances in a consumable format
     if callbacks and callbacks.distance then