File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
packages/runtime-dom/src/components Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,10 @@ const TransitionGroupImpl: ComponentOptions = {
132132 child ,
133133 resolveTransitionHooks ( child , cssTransitionProps , state , instance )
134134 )
135- positionMap . set ( child , ( child . el as Element ) . getBoundingClientRect ( ) )
135+ positionMap . set (
136+ child ,
137+ getRelativeBoundingClientRect ( child . el as Element )
138+ )
136139 }
137140 }
138141
@@ -170,8 +173,21 @@ function callPendingCbs(c: VNode) {
170173 }
171174}
172175
176+ function getRelativeBoundingClientRect ( el : Element ) {
177+ const elRect = el . getBoundingClientRect ( )
178+ if ( ! el . parentElement ) return elRect
179+ const parentRect = el . parentElement . getBoundingClientRect ( )
180+
181+ return new DOMRectReadOnly (
182+ elRect . x - parentRect . x ,
183+ elRect . y - parentRect . y ,
184+ elRect . width - parentRect . width ,
185+ elRect . height - parentRect . height
186+ )
187+ }
188+
173189function recordPosition ( c : VNode ) {
174- newPositionMap . set ( c , ( c . el as Element ) . getBoundingClientRect ( ) )
190+ newPositionMap . set ( c , getRelativeBoundingClientRect ( c . el as Element ) )
175191}
176192
177193function applyTranslation ( c : VNode ) : VNode | undefined {
You can’t perform that action at this time.
0 commit comments