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
100
dragState.mouseDeltaX = rect.left - e.clientX;
101
101
dragState.mouseDeltaY = rect.top - e.clientY;
102
102
103
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
273
+
// For touch: register non-passive touchstart to prevent scroll when touching selected card
274
274
+
$effect(() => {
275
275
+
if (!container || !selectedCardId) return;
276
276
+
container.addEventListener('touchstart', handleTouchStart, { passive: false });
277
277
+
return () => {
278
278
+
container?.removeEventListener('touchstart', handleTouchStart);
279
279
+
};
280
280
+
});
281
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
298
+
}
299
299
+
}
300
300
+
301
301
+
function handleTouchStart(e: TouchEvent) {
302
302
+
// On touch, prevent scrolling when touching the selected card
303
303
+
// This must happen on touchstart (not pointerdown) to claim the gesture
304
304
+
const cardEl = (e.target as HTMLElement)?.closest?.('.card') as HTMLElement | null;
305
305
+
if (cardEl && cardEl.id === selectedCardId) {
306
306
+
const item = items.find((i) => i.id === cardEl.id);
307
307
+
if (item && !item.cardData?.locked) {
308
308
+
e.preventDefault();
309
309
+
}
290
310
}
291
311
}
292
312