@@ -22,7 +22,7 @@ export function useSnapPoints({
2222 fadeFromIndex ?: number ;
2323 drawerRef : Ref < ComponentPublicInstance | null > ;
2424 overlayRef : Ref < ComponentPublicInstance | null > ;
25- onSnapPointChange ( activeSnapPointIndex : number ) : void ;
25+ onSnapPointChange ( activeSnapPointIndex : number , snapPointsOffset : number [ ] ) : void ;
2626 direction ?: DrawerDirection ;
2727 snapToSequentialPoint ?: boolean ;
2828} ) {
@@ -67,14 +67,13 @@ export function useSnapPoints({
6767
6868 const activeSnapPointIndex = computed ( ( ) => snapPoints ?. findIndex ( ( snapPoint ) => snapPoint === activeSnapPoint . value ) ?? null )
6969
70- const shouldFade = computed ( ( ) => (
70+ const shouldFade =
7171 ( snapPoints &&
7272 snapPoints . length > 0 &&
7373 ( fadeFromIndex || fadeFromIndex === 0 ) &&
7474 ! Number . isNaN ( fadeFromIndex ) &&
7575 snapPoints [ fadeFromIndex ] === activeSnapPoint . value
76- ) || ! snapPoints )
77- )
76+ ) || ! snapPoints
7877
7978 const snapPointsOffset = computed ( ( ) => {
8079 const containerSize = typeof window !== 'undefined'
@@ -116,7 +115,7 @@ export function useSnapPoints({
116115
117116 const snapToPoint = ( dimension : number ) => {
118117 const newSnapPointIndex = snapPointsOffset . value ?. findIndex ( ( snapPointDim ) => snapPointDim === dimension ) ?? null ;
119- onSnapPointChange ( newSnapPointIndex ) ;
118+ onSnapPointChange ( newSnapPointIndex , snapPointsOffset . value ) ;
120119
121120 set ( drawerRef . value ?. $el , {
122121 transition : `transform ${ TRANSITIONS . DURATION } s cubic-bezier(${ TRANSITIONS . EASE . join ( ',' ) } )` ,
@@ -257,7 +256,7 @@ export function useSnapPoints({
257256
258257 // Don't animate, but still use this one if we are dragging away from the overlaySnapPoint
259258 if ( isOverlaySnapPoint && ! isDraggingDown ) return 1 ;
260- if ( ! shouldFade . value && ! isOverlaySnapPoint ) return null ;
259+ if ( ! shouldFade && ! isOverlaySnapPoint ) return null ;
261260
262261 // Either fadeFrom index or the one before
263262 const targetSnapPointIndex = isOverlaySnapPoint ? activeSnapPointIndex . value + 1 : activeSnapPointIndex . value - 1 ;
@@ -286,4 +285,4 @@ export function useSnapPoints({
286285 onDrag,
287286 snapPointsOffset,
288287 } ;
289- }
288+ }
0 commit comments