File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
packages/embla-carousel/src/components Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ function EmblaCarousel(
188188 }
189189
190190 function scrollProgress ( ) : number {
191- return engine . scrollProgress . get ( engine . location . get ( ) )
191+ return engine . scrollProgress . get ( engine . offsetLocation . get ( ) )
192192 }
193193
194194 function selectedScrollSnap ( ) : number {
Original file line number Diff line number Diff line change @@ -187,12 +187,9 @@ export function Engine(
187187 const shouldSettle = scrollBody . settled ( )
188188 const withinBounds = ! scrollBounds . shouldConstrain ( )
189189 const hasSettled = loop ? shouldSettle : shouldSettle && withinBounds
190+ const hasSettledAndIdle = hasSettled && ! dragHandler . pointerDown ( )
190191
191- if ( hasSettled && ! dragHandler . pointerDown ( ) ) {
192- animation . stop ( )
193- eventHandler . emit ( 'settle' )
194- }
195- if ( ! hasSettled ) eventHandler . emit ( 'scroll' )
192+ if ( hasSettledAndIdle ) animation . stop ( )
196193
197194 const interpolatedLocation =
198195 location . get ( ) * alpha + previousLocation . get ( ) * ( 1 - alpha )
@@ -205,6 +202,9 @@ export function Engine(
205202 }
206203
207204 translate . to ( offsetLocation . get ( ) )
205+
206+ if ( hasSettledAndIdle ) eventHandler . emit ( 'settle' )
207+ if ( ! hasSettled ) eventHandler . emit ( 'scroll' )
208208 }
209209
210210 const animation = Animations (
You can’t perform that action at this time.
0 commit comments