fix(studio): remove rootRect subtraction from overlay position formula

elementRect.left/top from getBoundingClientRect() already reflects GSAP
transforms in viewport coordinates. Subtracting rootRect.left/top
cancels the transform, pinning overlays to the un-animated layout
position. Use elementRect directly so overlays track elements during
scroll (y: -500) and entrance (scale: 0.95) animations.
This commit is contained in:
Miguel Ángel
2026-05-25 19:47:53 -04:00
parent 825c0aa194
commit 66e90b7ad8
@@ -118,8 +118,8 @@ export function toOverlayRect(
});
return {
left: iframeRect.left - overlayRect.left + (elementRect.left - rootRect.left) * rootScaleX,
top: iframeRect.top - overlayRect.top + (elementRect.top - rootRect.top) * rootScaleY,
left: iframeRect.left - overlayRect.left + elementRect.left * rootScaleX,
top: iframeRect.top - overlayRect.top + elementRect.top * rootScaleY,
width: elementRect.width * rootScaleX,
height: elementRect.height * rootScaleY,
editScaleX: editScale.scaleX,