tangled
alpha
login
or
join now
flo-bit.dev
/
blento
21
fork
atom
your personal website on atproto - mirror
blento.app
21
fork
atom
overview
issues
pulls
pipelines
small fixes
Florian
1 month ago
c73e4d0b
f9466881
+21
-1
1 changed file
expand all
collapse all
unified
split
src
lib
layout
EditableGrid.svelte
+21
-1
src/lib/layout/EditableGrid.svelte
···
100
dragState.mouseDeltaX = rect.left - e.clientX;
101
dragState.mouseDeltaY = rect.top - e.clientY;
102
103
-
// Do NOT preventDefault — allow scroll on touch
104
document.addEventListener('pointermove', handlePointerMove);
105
document.addEventListener('pointerup', handlePointerUp);
106
document.addEventListener('pointercancel', handlePointerCancel);
···
271
};
272
});
273
0
0
0
0
0
0
0
0
0
274
// For touch: register non-passive touchmove to prevent scroll during active drag
275
$effect(() => {
276
if (phase !== 'active' || !container) return;
···
287
// Deselect when tapping empty grid space
288
if (e.target === e.currentTarget || !(e.target as HTMLElement)?.closest?.('.card')) {
289
ondeselect();
0
0
0
0
0
0
0
0
0
0
0
0
290
}
291
}
292
···
100
dragState.mouseDeltaX = rect.left - e.clientX;
101
dragState.mouseDeltaY = rect.top - e.clientY;
102
0
103
document.addEventListener('pointermove', handlePointerMove);
104
document.addEventListener('pointerup', handlePointerUp);
105
document.addEventListener('pointercancel', handlePointerCancel);
···
270
};
271
});
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
+
282
// For touch: register non-passive touchmove to prevent scroll during active drag
283
$effect(() => {
284
if (phase !== 'active' || !container) return;
···
295
// Deselect when tapping empty grid space
296
if (e.target === e.currentTarget || !(e.target as HTMLElement)?.closest?.('.card')) {
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
+
}
310
}
311
}
312