Skip to content

Commit

Permalink
Prevent accidental closing of SheetModal while x-scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Aug 31, 2023
1 parent 69da5b8 commit 2004965
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/atoms/SheetModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ function onEnd(event: PointerEvent) {
}
}
function onCancel(event: PointerEvent) {
dragging.value = false
container.value!.releasePointerCapture(event.pointerId)
animateShortly()
if (initialOpen)
open()
else
close()
}
function close() {
emit('update:progress', 0)
}
Expand Down Expand Up @@ -124,7 +134,7 @@ onBeforeUnmount(() => {
<template>
<article
ref="container" class="absolute h-full touch-pan-x sheet-transition will-change-auto"
:style="style" @pointerdown.prevent="onStart" @pointermove.prevent="onMove" @pointerup.prevent="onEnd"
:style="style" @pointerdown="onStart" @pointermove="onMove" @pointerup="onEnd" @pointercancel="onCancel"
>
<slot name="dragger">
<div class="relative">
Expand Down

0 comments on commit 2004965

Please sign in to comment.