MCPcopy Create free account
hub / github.com/dailydotdev/apps / onPointerUp

Function onPointerUp

packages/shared/src/components/shell/ShellCluster.tsx:417–444  ·  view source on GitHub ↗
(event: React.PointerEvent<HTMLDivElement>)

Source from the content-addressed store, hash-verified

415 };
416
417 const onPointerUp = (event: React.PointerEvent<HTMLDivElement>) => {
418 const { current } = pointer;
419 if (!current || current.id !== event.pointerId) {
420 return;
421 }
422 const { moved } = current;
423 const target = tabAt(event.clientX);
424 // A finger that lifts away from the bar, above or below it, cancels, as
425 // the iOS tab bar does.
426 const rect = trackRef.current?.getBoundingClientRect();
427 const away =
428 !!rect &&
429 (event.clientY < rect.top - cluster.cancelDistance ||
430 event.clientY > rect.bottom + cluster.cancelDistance);
431 endDrag(away || !target ? activeIndex : target.index);
432 if (!target || away || (!moved && event.pointerType !== 'touch')) {
433 return;
434 }
435 // A click may still follow the release; the pointer already chose.
436 suppressClick.current = true;
437 window.setTimeout(() => {
438 suppressClick.current = false;
439 }, motion.snap);
440 const tab = tabs[target.index];
441 if (!activate(tab)) {
442 moveShell(router, ShellMove.Switch, () => router.push(tab.href));
443 }
444 };
445
446 const onClickCapture = (event: React.MouseEvent) => {
447 if (suppressClick.current) {

Callers

nothing calls this directly

Calls 5

moveShellFunction · 0.90
tabAtFunction · 0.85
endDragFunction · 0.85
activateFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected