From 7966b17c998b836e1c0f37434da41af9ac589fe1 Mon Sep 17 00:00:00 2001 From: JuJuFX-dev Date: Tue, 15 Sep 2026 08:23:24 +0200 Subject: [PATCH] Unlock: keep cascade-moved elements out of the screen center ApplyAnchorPosition declared bCenterX/bCenterY inside the CENTER branch of the placement if/else, but the pendingPositions write near the end of the function sits outside that block. Lua read two never-set globals there, so an element the anchor cascade moved during unlock mode stored { point = "CENTER", x = nil, y = nil }. CommitPositions passes that straight to SaveBarPosition, ConvertToCenterPos short-circuits CENTER/CENTER to "x or 0, y or 0", and the saved position becomes the screen center. Invisible while the anchor stands (the position is recomputed every apply), but the element jumps to the middle of the screen once the anchor is removed. Hoist the declaration to function scope so the write reads the values that were actually SetPoint'd. Elements with their own grow direction are unaffected: those take the growSkip path above and store { _anchored = true }. --- EUI_UnlockMode.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/EUI_UnlockMode.lua b/EUI_UnlockMode.lua index 879c86c48..07c8359f2 100644 --- a/EUI_UnlockMode.lua +++ b/EUI_UnlockMode.lua @@ -3893,6 +3893,10 @@ ApplyAnchorPosition = function(childKey, targetKey, side, noMark, noMove, fromCa local uiW, uiH = UIParent:GetSize() local centerX = cx - uiW / 2 local centerY = cy - uiH / 2 + -- Declared at function scope on purpose: the pendingPositions write at the end + -- of this function reads them, and it sits outside the branch below that + -- computes them. Kept local, they were read as (never set) globals there. + local bCenterX, bCenterY -- Only move the actual bar frame when noMove is not set if not noMove then @@ -3962,8 +3966,8 @@ ApplyAnchorPosition = function(childKey, targetKey, side, noMark, noMove, fromCa end else -- Standard CENTER positioning for all other elements - local bCenterX = centerX * acRatio - local bCenterY = centerY * acRatio + bCenterX = centerX * acRatio + bCenterY = centerY * acRatio -- Snap the center FIRST (dim-aware for odd-pixel frames) so the idempotent -- skip below compares curX/curY (already snapped) against the value -- actually SetPoint'd. Snapping AFTER the check meant a bar whose snap