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

Function snapTarget

packages/shared/src/components/shell/ReadingDrawer.tsx:671–680  ·  view source on GitHub ↗
(from: number, y: number, velocity: number)

Source from the content-addressed store, hash-verified

669 let touchX = 0;
670 let touchY = 0;
671 const snapTarget = (from: number, y: number, velocity: number) => {
672 if (Math.abs(velocity) > flickSpeed) {
673 return velocity < 0 ? current.full : current.card;
674 }
675 const threshold = (current.full - current.card) * snapRatio;
676 if (from <= current.card) {
677 return y - current.card > threshold ? current.full : current.card;
678 }
679 return current.full - y > threshold ? current.card : current.full;
680 };
681 const onTouchStart = (event: TouchEvent) => {
682 dragging = true;
683 refreshMoving();

Callers 1

onTouchEndFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected