your personal website on atproto - mirror blento.app

small fixes

Florian c73e4d0b f9466881

+21 -1
+21 -1
src/lib/layout/EditableGrid.svelte
··· 100 100 dragState.mouseDeltaX = rect.left - e.clientX; 101 101 dragState.mouseDeltaY = rect.top - e.clientY; 102 102 103 - // Do NOT preventDefault — allow scroll on touch 104 103 document.addEventListener('pointermove', handlePointerMove); 105 104 document.addEventListener('pointerup', handlePointerUp); 106 105 document.addEventListener('pointercancel', handlePointerCancel); ··· 271 270 }; 272 271 }); 273 272 273 + // For touch: register non-passive touchstart to prevent scroll when touching selected card 274 + $effect(() => { 275 + if (!container || !selectedCardId) return; 276 + container.addEventListener('touchstart', handleTouchStart, { passive: false }); 277 + return () => { 278 + container?.removeEventListener('touchstart', handleTouchStart); 279 + }; 280 + }); 281 + 274 282 // For touch: register non-passive touchmove to prevent scroll during active drag 275 283 $effect(() => { 276 284 if (phase !== 'active' || !container) return; ··· 287 295 // Deselect when tapping empty grid space 288 296 if (e.target === e.currentTarget || !(e.target as HTMLElement)?.closest?.('.card')) { 289 297 ondeselect(); 298 + } 299 + } 300 + 301 + function handleTouchStart(e: TouchEvent) { 302 + // On touch, prevent scrolling when touching the selected card 303 + // This must happen on touchstart (not pointerdown) to claim the gesture 304 + const cardEl = (e.target as HTMLElement)?.closest?.('.card') as HTMLElement | null; 305 + if (cardEl && cardEl.id === selectedCardId) { 306 + const item = items.find((i) => i.id === cardEl.id); 307 + if (item && !item.cardData?.locked) { 308 + e.preventDefault(); 309 + } 290 310 } 291 311 } 292 312