Quantcast

- Changed the MoveAnything check to cover all frames Titan adjusts

urnati [10-03-18 - 01:34]
- Changed the MoveAnything check to cover all frames Titan adjusts
- Removed commented out code
Filename
Titan/TitanMovable.lua
diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua
index 1308d7e..957afa3 100755
--- a/Titan/TitanMovable.lua
+++ b/Titan/TitanMovable.lua
@@ -153,9 +153,7 @@ OUT: top_bottom - Frame is at top or bottom, expecting Titan constant for top or
 --]]
 local function MoveFrame(frame_ptr, start_y, top_bottom)
 	local frame = _G[frame_ptr]
-	if frame and (frame:IsUserPlaced()
-			or frame.MALockPointHook  -- Allow MoveAnything to be used w/o error
-		)
+	if frame and frame:IsUserPlaced()
 	then
 		-- skip this frame
 	else
@@ -182,25 +180,34 @@ OUT: top_bottom - Frame is at top or bottom, expecting Titan constant for top or
 --]]
 local function MoveMenuFrame(frame_ptr, start_y, top_bottom)
 	local frame = _G[frame_ptr]
-	if frame then
+	if frame
+		-- do not check IsUserPlaced because Titan sets this.
+		-- Setting IsUserPlaced was done to prevent bottom bars 'bouncing'
+	then
 		local yOffset = TitanMovable_GetPanelYOffset(top_bottom) -- includes scale adjustment
-		xOffset = TitanMovableFrame_GetXOffset(frame, top_bottom);
+		--xOffset = TitanMovableFrame_GetXOffset(frame, top_bottom);
 		if ( StatusTrackingBarManager:GetNumberVisibleBars() == 2 ) then
 			yOffset = yOffset + 17;
 		elseif ( StatusTrackingBarManager:GetNumberVisibleBars() == 1 ) then
 			yOffset = yOffset + 14;
 		end
-		frame:ClearAllPoints();
-		-- This is a hack because GetPoint on MainMenuBar often returns all nil
-		-- If the scale is is around .85 or higher the bag menu overlaps the main menu
+		frame:ClearAllPoints();
+		--[[
+		If the scale is around .85 or higher the bag menu overlaps the main menu
+		when the right menu bar is shown (adding more bottom buttons)
+		So shift the menu bar right a little based on the scaling.
+		We may have to get fancy checking exactly what is shown before shifting.
+		--]]
 		local fscale = tonumber(GetCVar("uiScale"))
 		local xadj = (fscale * 100) - 85
 		if xadj <= 0 then
 			xOfs = 0
 		else
-			-- Slide the menu bar left depending on scaling to allow bag menu room
 			xOfs = xadj * 6 * -1
 		end
+		--[[
+		This is a hack because GetPoint on MainMenuBar often returns nil values.
+		--]]
 		frame:SetPoint("BOTTOM", "UIParent", "BOTTOM", xOfs, yOffset);
 	else
 		-- Unknown frame...
@@ -364,17 +371,7 @@ local MData = {
 		addonAdj = false, },
 	[7] = {frameName = "MultiBarRight",
 		move = function ()
-			local yOffset = 0
---[[
-			local yOffset = 98
-			local playerlevel = UnitLevel("player");
-			if ReputationWatchStatusBar
-			and ReputationWatchStatusBar:IsVisible()
-			and playerlevel < _G["MAX_PLAYER_LEVEL"] then
-				yOffset = yOffset + 8;
-			end
---]]
-			MoveFrame("MultiBarRight", yOffset, TITAN_PANEL_PLACE_BOTTOM) end,
+			MoveFrame("MultiBarRight", 0, TITAN_PANEL_PLACE_BOTTOM) end,
 		addonAdj = false, },
 	[8] = {frameName = "OverrideActionBar",
 		move = function () MoveFrame("OverrideActionBar", 0, TITAN_PANEL_PLACE_BOTTOM) end,
@@ -435,8 +432,11 @@ local function TitanMovableFrame_MoveFrames()
 	if not InCombatLockdown() then
 		for i = 1,#MData,1 do
 			if MData[i] then
-				if MData[i].addonAdj then
-					-- An addon has taken control of the frame so skip
+				local frame = _G[MData[i].frameName]
+				if MData[i].addonAdj      -- An addon has taken control of the frame
+				or frame.MALockPointHook  -- Allow MoveAnything to be used w/o error
+				then
+					-- skip
 				else
 					-- Adjust the frame per MData
 					local ok, msg = pcall(function () MData[i].move() end)