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

Function onTouchEnd

packages/shared/src/components/shell/ReadingDrawer.tsx:745–761  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

743 onScroll();
744 };
745 const onTouchEnd = () => {
746 dragging = false;
747 take = null;
748 if (!held) {
749 return;
750 }
751 const { from, samples } = held;
752 const y = virtualY ?? from;
753 held = null;
754 let velocity = 0;
755 if (samples.length >= 2) {
756 const [firstY, firstAt] = samples[0];
757 const [lastTouchY, lastAt] = samples[samples.length - 1];
758 velocity = (lastTouchY - firstY) / Math.max(1, lastAt - firstAt);
759 }
760 glideTo(snapTarget(from, y, velocity));
761 };
762
763 // Close plays the opening backwards: the page rises from wherever the
764 // drawer stands to where it stood before Read, by the same transform,

Callers

nothing calls this directly

Calls 2

snapTargetFunction · 0.85
glideToFunction · 0.70

Tested by

no test coverage detected