Quantcast

- Fixes for Movable

urnati [08-08-19 - 19:13]
- Fixes for Movable
Filename
TitanClassic/TitanClassicMovable.lua
diff --git a/TitanClassic/TitanClassicMovable.lua b/TitanClassic/TitanClassicMovable.lua
index 3419b45..6e84a44 100755
--- a/TitanClassic/TitanClassicMovable.lua
+++ b/TitanClassic/TitanClassicMovable.lua
@@ -311,8 +311,60 @@ OUT: top_bottom - Frame is at top or bottom, expecting Titan constant for top or
 local function MoveFrame(frame_ptr, start_y, top_bottom, force)
 	local frame = _G[frame_ptr]

+	if frame then
 -- Urnati : Removing MA check as MoveAnything may not migrate to Classic and the logic is causing frame nils.
-
+		if DoAdjust(top_bottom, force) and frame:IsShown() then
+			local y = TitanMovable_GetPanelYOffset(top_bottom) + (start_y or 0) -- includes scale adjustment
+			local point, relativeTo, relativePoint, xOfs, yOfs = frame:GetPoint()
+			-- check for nil which will cause an error
+			if point and relativeTo and relativePoint and xOfs then -- do not care about yOfs
+				-- should be safe...
+--				frame:ClearAllPoints();
+--				frame:SetPoint(point, relativeTo:GetName(), relativePoint, xOfs, y)
+--[[
+				if frame == ExtraActionBarFrame then
+				TitanDebug ("MoveFrame :"
+					.." "..tostring(frame:GetName())
+					.." point:"..tostring(point)
+					.." relativeTo:"..tostring(relativeTo:GetName())
+					.." relativePoint:"..tostring(relativePoint)
+					.." xOfs:"..tostring(xOfs)
+					.." y:"..tostring(y)
+					)
+				end
+--]]
+				SetPosition(frame, point, relativeTo:GetName(), relativePoint, xOfs, y)
+			else
+				-- do not proceed
+--[[
+				TitanDebug ("MoveFrame nil :"
+					.." "..tostring(frame:GetName())
+					.."point:"..tostring(point)
+					.."relativeTo:"..tostring(relativeTo:GetName())
+					.."relativePoint:"..tostring(relativePoint)
+					.."xOfs:"..tostring(xOfs)
+					)
+--]]
+			end
+		else
+			--[[
+			Some frames such as the ticket frame may not be visible or even created
+			--]]
+--[[
+				TitanDebug ("MoveFrame no adj :"
+					.." "..tostring(frame:GetName())
+					.." adj: "..tostring(DoAdjust(top_bottom, force))
+					.." shown: "..tostring(frame:IsShown())
+					)
+--]]
+		end
+	else
+--[[
+		TitanDebug ("MoveFrame nil found :"
+			.." "..tostring(frame_ptr)
+			)
+--]]
+	end
 end

 --[[ local
@@ -333,14 +385,8 @@ local function MoveMenuFrame(frame_ptr, start_y, top_bottom, force)
 		and DoAdjust(top_bottom, force)
 	then
 		local yOffset = TitanMovable_GetPanelYOffset(top_bottom) -- includes scale adjustment
-		xOffset = TitanMovableFrame_GetXOffset(frame, top_bottom);
+--		xOffset = TitanMovableFrame_GetXOffset(frame, top_bottom);
 --[[ Urnati : Is StatusTrackingBarManager needed in this case since the above xOffset is active again? --]]
-		if ( StatusTrackingBarManager:GetNumberVisibleBars() == 2 ) then
-			yOffset = yOffset + 17;
-		elseif ( StatusTrackingBarManager:GetNumberVisibleBars() == 1 ) then
-			yOffset = yOffset + 14;
-		end
-
 		xOfs = TitanPanelGetVar("MainMenuBarXAdj")

 		SetPosition(frame, "BOTTOM", "UIParent", "BOTTOM", xOfs, yOffset)