@@ -429,28 +429,28 @@ export const createSheetGesture = (
429429 offset = clamp ( 0.0001 , processedStep , maxStep ) ;
430430 animation . progressStep ( offset ) ;
431431
432- const predicted = calculatePredictedBreakpoint ( detail . deltaY ) ;
432+ const snapBreakpoint = calculateSnapBreakpoint ( detail . deltaY ) ;
433433
434434 const eventDetail : ModalDragEventDetail = {
435435 currentY : detail . currentY ,
436436 deltaY : detail . deltaY ,
437437 velocityY : detail . velocityY ,
438438 progress : calculateProgress ( detail . currentY ) ,
439- predictedBreakpoint : predicted ,
439+ snapBreakpoint : snapBreakpoint ,
440440 } ;
441441
442442 onDragMove ( eventDetail ) ;
443443 } ;
444444
445445 const onEnd = ( detail : GestureDetail ) => {
446- const predicted = calculatePredictedBreakpoint ( detail . deltaY ) ;
446+ const snapBreakpoint = calculateSnapBreakpoint ( detail . deltaY ) ;
447447
448448 const eventDetail : ModalDragEventDetail = {
449449 currentY : detail . currentY ,
450450 deltaY : detail . deltaY ,
451451 velocityY : detail . velocityY ,
452452 progress : calculateProgress ( detail . currentY ) ,
453- predictedBreakpoint : predicted ,
453+ snapBreakpoint ,
454454 } ;
455455
456456 /**
@@ -473,7 +473,7 @@ export const createSheetGesture = (
473473 }
474474
475475 moveSheetToBreakpoint ( {
476- breakpoint : predicted ,
476+ breakpoint : snapBreakpoint ,
477477 breakpointOffset : offset ,
478478 canDismiss : canDismissBlocksGesture ,
479479
@@ -644,31 +644,34 @@ export const createSheetGesture = (
644644 } ;
645645
646646 /**
647- * Calculates the predicted breakpoint based on the current deltaY.
647+ * Calculates the breakpoint based on the current deltaY.
648648 * This determines where the sheet should snap to when the user releases the
649649 * gesture.
650650 *
651651 * @param deltaY The change in Y position since the gesture started.
652- * @returns The predicted breakpoint value.
652+ * @returns The snap breakpoint value.
653653 */
654- const calculatePredictedBreakpoint = ( deltaY : number ) : number => {
654+ const calculateSnapBreakpoint = ( deltaY : number ) : number => {
655655 /**
656656 * Calculates the real-time vertical position of the modal.
657- * We combine the wrapper's current bounding box position with the gesture's
658- * deltaY to account for the physical movement during the drag.
657+ * We combine the wrapper's current bounding box position with the
658+ * gesture's deltaY to account for the physical movement during the drag.
659659 */
660660 const currentY = wrapperEl . getBoundingClientRect ( ) . top + deltaY ;
661+ /**
662+ * Convert that pixel position back into a 0 to 1 progress value.
663+ */
661664 const currentProgress = calculateProgress ( currentY ) ;
662665
663666 /**
664- * Find the breakpoint in the array that has the
665- * smallest absolute distance to our current progress.
667+ * Find and return the defined breakpoint that is closest to the
668+ * current progress.
666669 */
667- const predicted = breakpoints . reduce ( ( a , b ) => {
670+ const snapBreakpoint = breakpoints . reduce ( ( a , b ) => {
668671 return Math . abs ( b - currentProgress ) < Math . abs ( a - currentProgress ) ? b : a ;
669672 } ) ;
670673
671- return predicted ;
674+ return snapBreakpoint ;
672675 } ;
673676
674677 /**
0 commit comments