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 }); + } + }
{#if message} -
+ + +
+
+
{#if message.imageUrl} message attachment @@ -64,12 +89,19 @@ transform: translateY(0); } + .handle-area { + display: flex; + justify-content: center; + padding: 12px 0; + margin-bottom: 0.25rem; + touch-action: none; /* stop the browser from treating the drag as a page scroll */ + } + .handle { width: 40px; height: 4px; background: #ddd; border-radius: 2px; - margin: 0 auto 1rem; } .message-text { diff --git a/src/lib/components/MapView.Svelte b/src/lib/components/MapView.Svelte index a3994e3..a168e92 100644 --- a/src/lib/components/MapView.Svelte +++ b/src/lib/components/MapView.Svelte @@ -8,7 +8,7 @@ // export let longitude; // ^ this didn't work for some reason, so instead we get the props like this: (based on internet research this is the fix) let { lat, lng } = $props(); -s + let mapDiv; let map = $state(null); diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index df4c21b..6920698 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -72,6 +72,7 @@ {#if !$mapStore.composing}