@@ -954,33 +954,13 @@ export function initSandboxRuntimeModular(): void {
954954 state . capturedTimeline . totalTime ( seekTime , false ) ;
955955 }
956956
957- // Strip stale CSS offset artifacts from GSAP-targeted elements.
958- // These leak into the HTML when the CSS offset path fires for a
959- // GSAP-animated element (stale cache race). On reload, both the
960- // offset and GSAP transform stack, doubling the visual position.
961- const staleEls = document . querySelectorAll ( "[data-hf-studio-path-offset]" ) ;
962- if ( staleEls . length > 0 && state . capturedTimeline . getChildren ) {
963- const tweenTargets = new Set < Element > ( ) ;
964- try {
965- for ( const child of state . capturedTimeline . getChildren ( true ) ) {
966- if ( typeof child . targets === "function" ) {
967- for ( const t of child . targets ( ) ) tweenTargets . add ( t ) ;
968- }
969- }
970- } catch {
971- /* timeline access guard */
972- }
973- for ( const el of staleEls ) {
974- if ( ! tweenTargets . has ( el ) ) continue ;
975- const htmlEl = el as HTMLElement ;
976- htmlEl . removeAttribute ( "data-hf-studio-path-offset" ) ;
977- htmlEl . removeAttribute ( "data-hf-studio-original-translate" ) ;
978- htmlEl . removeAttribute ( "data-hf-studio-original-inline-translate" ) ;
979- htmlEl . style . removeProperty ( "--hf-studio-offset-x" ) ;
980- htmlEl . style . removeProperty ( "--hf-studio-offset-y" ) ;
981- htmlEl . style . removeProperty ( "translate" ) ;
982- }
983- }
957+ // GSAP bakes the CSS `translate` into style.transform on seek.
958+ // The Studio seek wrapper (installStudioManualEditSeekReapply) calls
959+ // reapplyPositionEditsAfterSeek to un-bake it. Call the apply hook
960+ // directly here as well, since the wrapper may not be installed yet
961+ // during initial rebind (timing race on first load / soft reload).
962+ const applyFn = ( window as Record < string , unknown > ) . __hfStudioManualEditsApply ;
963+ if ( typeof applyFn === "function" ) applyFn ( ) ;
984964 }
985965 if ( resolution . diagnostics ) {
986966 postRuntimeMessage ( {
@@ -1002,25 +982,12 @@ export function initSandboxRuntimeModular(): void {
1002982 } ) ;
1003983 // Stamp data-start / data-duration on GSAP-targeted elements that lack
1004984 // them so the Studio timeline can discover individual animated elements.
1005- // Skip elements whose ancestor already carries timing — stamping them
1006- // would override the parent's clip visibility and cause preview/render
1007- // parity drift.
1008985 {
1009986 const rootComp = resolveRootCompositionElement ( ) ;
1010987 const rootDuration = boundDuration > 0 ? boundDuration : 0 ;
1011988 const dur = String ( rootDuration > 0 ? rootDuration : 1 ) ;
1012989 const seen = new Set < Element > ( ) ;
1013990
1014- const hasTimedAncestor = ( el : HTMLElement ) : boolean => {
1015- let cursor = el . parentElement ;
1016- while ( cursor ) {
1017- if ( cursor . hasAttribute ( "data-start" ) ) return true ;
1018- if ( cursor === rootComp ) return false ;
1019- cursor = cursor . parentElement ;
1020- }
1021- return false ;
1022- } ;
1023-
1024991 // Stamp GSAP-targeted elements
1025992 if ( state . capturedTimeline . getChildren ) {
1026993 try {
@@ -1030,7 +997,6 @@ export function initSandboxRuntimeModular(): void {
1030997 if ( ! ( target instanceof HTMLElement ) ) continue ;
1031998 if ( target === rootComp ) continue ;
1032999 if ( target . hasAttribute ( "data-start" ) ) continue ;
1033- if ( hasTimedAncestor ( target ) ) continue ;
10341000 if ( seen . has ( target ) ) continue ;
10351001 seen . add ( target ) ;
10361002 target . setAttribute ( "data-start" , "0" ) ;
@@ -1050,7 +1016,6 @@ export function initSandboxRuntimeModular(): void {
10501016 if ( ! ( el instanceof HTMLElement ) ) continue ;
10511017 if ( el === rootComp ) continue ;
10521018 if ( el . hasAttribute ( "data-start" ) ) continue ;
1053- if ( hasTimedAncestor ( el ) ) continue ;
10541019 if ( seen . has ( el ) ) continue ;
10551020 if ( el . tagName === "SCRIPT" || el . tagName === "STYLE" || el . tagName === "LINK" ) continue ;
10561021 seen . add ( el ) ;
0 commit comments