Quantcast

- Titan Locatio : FIx for #1381; change the check to tell if map is large (ma) or small

urnati [01-13-24 - 00:45]
- Titan Locatio : FIx for #1381; change the check to tell if map is large (ma) or small
Filename
TitanLocation/TitanLocation.lua
diff --git a/TitanLocation/TitanLocation.lua b/TitanLocation/TitanLocation.lua
index 221191e..ae8c156 100755
--- a/TitanLocation/TitanLocation.lua
+++ b/TitanLocation/TitanLocation.lua
@@ -611,68 +611,28 @@ print("TLoc"

 			TitanMapPlayerLocation:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOM", 0, 10)
 			TitanMapCursorLocation:SetPoint("BOTTOMRIGHT", WorldMapFrame, "BOTTOM", -10, 10)
---			TitanMapPlayerLocation:SetPoint("BOTTOMRIGHT", WorldMapFrame, "BOTTOM", -buff, 10)
---			TitanMapCursorLocation:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOM", 0, 10)
---[[
-			if (mloc == "TOPRIGHT") then
-				TitanMapPlayerLocation:SetPoint("TOPRIGHT", WorldMapFrame, "TOPRIGHT", -10, -28)
-				TitanMapCursorLocation:SetPoint("TOPRIGHT", TitanMapPlayerLocation, "BOTTOMRIGHT", 0, 0)
-			elseif (mloc == "TOPLEFT") then
-				TitanMapPlayerLocation:SetPoint("TOPLEFT", WorldMapFrame, "TOPLEFT", 10, -28)
-				TitanMapCursorLocation:SetPoint("TOPLEFT", TitanMapPlayerLocation, "BOTTOMLEFT", 0, 0)
-			elseif (mloc == "BOTTOMLEFT") then
-				TitanMapPlayerLocation:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOMLEFT", 10, 10)
-				TitanMapCursorLocation:SetPoint("BOTTOMLEFT", TitanMapPlayerLocation, "BOTTOMRIGHT", buff, 0)
-			elseif (mloc == "BOTTOMRIGHT") then
-				TitanMapPlayerLocation:SetPoint("BOTTOMRIGHT", TitanMapCursorLocation, "BOTTOMLEFT", -buff, 0)
-				TitanMapCursorLocation:SetPoint("BOTTOMRIGHT", WorldMapFrame, "BOTTOMRIGHT", -xbuff, 10)
-			elseif (mloc == "BOTTOM") then
-				TitanMapPlayerLocation:SetPoint("BOTTOMRIGHT", WorldMapFrame, "BOTTOM", -buff, 10)
-				TitanMapCursorLocation:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOM", 0, 10)
-			end
-		elseif Titan_Panel.game_ver == "Classic_Era" then
-			-- Determine where to show the text
-			TitanMapPlayerLocation:ClearAllPoints()
-			TitanMapCursorLocation:ClearAllPoints()
-
-			if (mloc == "TOPRIGHT") then
-				TitanMapPlayerLocation:SetPoint("TOPRIGHT", WorldMapFrame, "TOPRIGHT", -10, -28)
-				TitanMapCursorLocation:SetPoint("TOPRIGHT", TitanMapPlayerLocation, "BOTTOMRIGHT", 0, 0)
-			elseif (mloc == "TOPLEFT") then
-				TitanMapPlayerLocation:SetPoint("TOPLEFT", WorldMapFrame, "TOPLEFT", 10, -28)
-				TitanMapCursorLocation:SetPoint("TOPLEFT", TitanMapPlayerLocation, "BOTTOMLEFT", 0, 0)
-			elseif (mloc == "BOTTOMLEFT") then
-				TitanMapPlayerLocation:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOMLEFT", 15, 10)
-				TitanMapCursorLocation:SetPoint("BOTTOMLEFT", TitanMapPlayerLocation, "BOTTOMRIGHT", buff, 0)
-			elseif (mloc == "BOTTOMRIGHT") then
-				TitanMapPlayerLocation:SetPoint("BOTTOMRIGHT", TitanMapCursorLocation, "BOTTOMLEFT", -buff, 0)
-				TitanMapCursorLocation:SetPoint("BOTTOMRIGHT", WorldMapFrame, "BOTTOMRIGHT", -xbuff, 10)
-			elseif (mloc == "BOTTOM") then
-				TitanMapPlayerLocation:SetPoint("BOTTOMRIGHT", WorldMapFrame, "BOTTOM", -buff, 10)
-				TitanMapCursorLocation:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOM", 0, 10)
-			end
---]]
 		else -- current retail
 			-- Position the text
-			if MapMinMaxFrame.MaximizeButton:IsShown() then
-				if WorldMapFrame.TitanSizePrev == "small" then
+			if WorldMapFrame:IsMaximized() then
+				-- map should be 'full' screen
+				if WorldMapFrame.TitanSizePrev == "large" then
 					-- no change
 				else
 					TitanMapPlayerLocation:ClearAllPoints();
 					TitanMapCursorLocation:ClearAllPoints();
 					TitanMapPlayerLocation:SetPoint("RIGHT", MapMinMaxFrame, "LEFT", 0, 0)
-					TitanMapCursorLocation:SetPoint("LEFT", WorldMapFrame.BorderFrame.Tutorial, "RIGHT", 0, 0)
-					WorldMapFrame.TitanSize = "small"
+					TitanMapCursorLocation:SetPoint("TOP", TitanMapPlayerLocation, "BOTTOM", 0, -5)
+					WorldMapFrame.TitanSize = "large"
 				end
-			else -- map should be 'full' screen
-				if WorldMapFrame.TitanSizePrev == "large" then
+			else
+				if WorldMapFrame.TitanSizePrev == "small" then
 					-- no change
 				else
 					TitanMapPlayerLocation:ClearAllPoints();
 					TitanMapCursorLocation:ClearAllPoints();
 					TitanMapPlayerLocation:SetPoint("RIGHT", MapMinMaxFrame, "LEFT", 0, 0)
-					TitanMapCursorLocation:SetPoint("TOP", TitanMapPlayerLocation, "BOTTOM", 0, -5)
-					WorldMapFrame.TitanSize = "large"
+					TitanMapCursorLocation:SetPoint("LEFT", WorldMapFrame.BorderFrame.Tutorial, "RIGHT", 0, 0)
+					WorldMapFrame.TitanSize = "small"
 				end
 			end
 		end
@@ -707,48 +667,47 @@ end
 -- VARS : none
 -- **************************************************************************
 --]]
-local TPL_CMF_IsFirstTime = true;
 function TitanPanelLocation_CreateMapFrames()
-	if (TPL_CMF_IsFirstTime) then
-		TPL_CMF_IsFirstTime = false;
+	if _G[TitanMapFrame] then
+		return -- if already created
+	end

-		-- avoid an addon conflict
-		if (_G["CT_MapMod"]) then
-			return;
-		end
+	-- avoid an addon conflict
+	if (_G["CT_MapMod"]) then
+		return;
+	end

-		-- create the frame to hold the font strings, and simulate an "OnUpdate" script handler using C_Timer for efficiency
+	-- create the frame to hold the font strings, and simulate an "OnUpdate" script handler using C_Timer for efficiency
 --		local frame = CreateFrame("FRAME", "TitanMapFrame", WorldMapFrame.BorderFrame)
-		local frame = CreateFrame("FRAME", "TitanMapFrame", WorldMapFrame)
-		frame:SetFrameStrata("DIALOG") -- DF need to raise the strata to be seen
-		local function updateFunc()
-			TitanMapFrame_OnUpdate(frame, 0.07);	-- simulating an OnUpdate call
-		end
-		frame:HookScript("OnShow", function()
-			frame.updateTicker = frame.updateTicker or C_Timer.NewTicker(0.07, updateFunc);
-			if MapMinMaxFrame.MaximizeButton:IsShown() then
-				WorldMapFrame.TitanSize = "small"
-				WorldMapFrame.TitanSizePrev = "none"
-			else
-				WorldMapFrame.TitanSize = "large"
-				WorldMapFrame.TitanSizePrev = "none"
-			end
-		end);
-		frame:HookScript("OnHide", function()
-			if (frame.updateTicker) then
-				frame.updateTicker:Cancel();
-				frame.updateTicker = nil;
-			end
-		end);
-
-		-- create the font strings and update their position based in minimizing/maximizing the main map
-		local playertext = frame:CreateFontString("TitanMapPlayerLocation", "ARTWORK", "GameFontNormal");
-		local cursortext = frame:CreateFontString("TitanMapCursorLocation", "ARTWORK", "GameFontNormal");
-		playertext:ClearAllPoints();
-		cursortext:ClearAllPoints();
-		playertext:SetPoint("TOPRIGHT", WorldMapFrameCloseButton, "BOTTOMRIGHT", 0, 0)
-		cursortext:SetPoint("TOP", playertext, "BOTTOM", 0, 0)
+	local frame = CreateFrame("FRAME", "TitanMapFrame", WorldMapFrame)
+	frame:SetFrameStrata("DIALOG") -- DF need to raise the strata to be seen
+	local function updateFunc()
+		TitanMapFrame_OnUpdate(frame, 0.07);	-- simulating an OnUpdate call
 	end
+	frame:HookScript("OnShow", function()
+		frame.updateTicker = frame.updateTicker or C_Timer.NewTicker(0.07, updateFunc);
+		if WorldMapFrame:IsMaximized() then
+			WorldMapFrame.TitanSize = "large"
+			WorldMapFrame.TitanSizePrev = "none"
+		else
+			WorldMapFrame.TitanSize = "small"
+			WorldMapFrame.TitanSizePrev = "none"
+		end
+	end);
+	frame:HookScript("OnHide", function()
+		if (frame.updateTicker) then
+			frame.updateTicker:Cancel();
+			frame.updateTicker = nil;
+		end
+	end);
+
+	-- create the font strings and update their position based in minimizing/maximizing the main map
+	local playertext = frame:CreateFontString("TitanMapPlayerLocation", "ARTWORK", "GameFontNormal");
+	local cursortext = frame:CreateFontString("TitanMapCursorLocation", "ARTWORK", "GameFontNormal");
+	playertext:ClearAllPoints();
+	cursortext:ClearAllPoints();
+	playertext:SetPoint("TOPRIGHT", WorldMapFrameCloseButton, "BOTTOMRIGHT", 0, 0)
+	cursortext:SetPoint("TOP", playertext, "BOTTOM", 0, 0)
 end