File tree 2 files changed +6
-6
lines changed
packages/embla-carousel/src/components
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ function EmblaCarousel(
188
188
}
189
189
190
190
function scrollProgress ( ) : number {
191
- return engine . scrollProgress . get ( engine . location . get ( ) )
191
+ return engine . scrollProgress . get ( engine . offsetLocation . get ( ) )
192
192
}
193
193
194
194
function selectedScrollSnap ( ) : number {
Original file line number Diff line number Diff line change @@ -187,12 +187,9 @@ export function Engine(
187
187
const shouldSettle = scrollBody . settled ( )
188
188
const withinBounds = ! scrollBounds . shouldConstrain ( )
189
189
const hasSettled = loop ? shouldSettle : shouldSettle && withinBounds
190
+ const hasSettledAndIdle = hasSettled && ! dragHandler . pointerDown ( )
190
191
191
- if ( hasSettled && ! dragHandler . pointerDown ( ) ) {
192
- animation . stop ( )
193
- eventHandler . emit ( 'settle' )
194
- }
195
- if ( ! hasSettled ) eventHandler . emit ( 'scroll' )
192
+ if ( hasSettledAndIdle ) animation . stop ( )
196
193
197
194
const interpolatedLocation =
198
195
location . get ( ) * alpha + previousLocation . get ( ) * ( 1 - alpha )
@@ -205,6 +202,9 @@ export function Engine(
205
202
}
206
203
207
204
translate . to ( offsetLocation . get ( ) )
205
+
206
+ if ( hasSettledAndIdle ) eventHandler . emit ( 'settle' )
207
+ if ( ! hasSettled ) eventHandler . emit ( 'scroll' )
208
208
}
209
209
210
210
const animation = Animations (
You can’t perform that action at this time.
0 commit comments