diff --git a/src/lib/components/BottomSheet.svelte b/src/lib/components/BottomSheet.svelte index 3a2de26..04e9b4a 100644 --- a/src/lib/components/BottomSheet.svelte +++ b/src/lib/components/BottomSheet.svelte @@ -15,12 +15,37 @@ await echoMessage(message.id); echoed = true; } + + let startY = 0; // where the swipe started + + function startDrag(e) { + startY = e.clientY; // remember the starting y position + window.addEventListener('pointerup', endDrag, { once: true }); // wait for them to let go + } + + function endDrag(e) { + const diff = e.clientY - startY; // how far down they dragged + // if they dragged down more than 60px, close the sheet + if (diff > 60) { + mapStore.set({ selectedMessage: null, composing: false }); + } + }