@@ -82,7 +82,7 @@ const handleEscapeKey = (e: KeyboardEvent) => {
8282const open = () => {
8383 if (! sheet .value ) return
8484
85- height .value = props .defaultBreakpoint ?? minSnap .value
85+ height .value = Math . min ( props .defaultBreakpoint ?? minSnap .value , windowHeight . value )
8686
8787 set ({
8888 height: height .value ,
@@ -191,7 +191,8 @@ const handleDragEnd: Handler<'drag', PointerEvent> | undefined = () => {
191191 close ()
192192 }
193193
194- height .value = snapPoints .value [closestSnapPoint .value ]
194+ height .value = Math .min (snapPoints .value [closestSnapPoint .value ], windowHeight .value )
195+
195196 push (' height' , height .value , motionProperties , { type: ' tween' , easings: ' easeInOut' , bounce: 0 , duration: 300 })
196197}
197198
@@ -238,7 +239,7 @@ useGesture(
238239 }
239240 }
240241 },
241- onDrag : ({ delta }) => {
242+ onDrag : ({ delta , direction }) => {
242243 if (! props .expandOnContentDrag ) {
243244 preventScroll .value = false
244245 return
@@ -268,6 +269,8 @@ useGesture(
268269 height .value = maxSnap .value
269270 }
270271
272+ height .value = Math .min (height .value , windowHeight .value )
273+
271274 const isAtTop = sheetScroll .value ! .scrollTop === 0
272275 if (snapPoints .value .length === 1 ) {
273276 if (delta [1 ] < 0 && translateY .value === 0 && isAtTop ) {
@@ -282,6 +285,12 @@ useGesture(
282285 set ({
283286 height: height .value ,
284287 })
288+
289+ if (direction [1 ] > 0 ) {
290+ emit (' dragging-down' )
291+ } else if (direction [1 ] < 0 ) {
292+ emit (' dragging-up' )
293+ }
285294 },
286295 onDragEnd: handleDragEnd ,
287296 },
@@ -297,7 +306,7 @@ watch(minHeightComputed, () => {
297306 if (snapPoints .value .length === 1 ) {
298307 nextTick (() => {
299308 if (snapPoints .value [0 ] === minHeightComputed .value ) {
300- snapToPoint (minHeightComputed .value )
309+ snapToPoint (Math . min ( minHeightComputed .value , windowHeight . value ) )
301310 }
302311 })
303312 }
0 commit comments