Polish PWA gestures, transitions and nutrition averages
All checks were successful
Verify and publish Calio container / build-and-push (push) Successful in 32s
All checks were successful
Verify and publish Calio container / build-and-push (push) Successful in 32s
This commit is contained in:
parent
b19de6f9ea
commit
7288e56c02
16 changed files with 1019 additions and 245 deletions
9
shared/navigation.js
Normal file
9
shared/navigation.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// Direction is the next tab (+1) or previous tab (-1). Vertical scrolling wins
|
||||
// unless a gesture has a clear horizontal intent; small jitter never navigates.
|
||||
export function swipeStep(dx, dy, elapsed, width) {
|
||||
if (Math.abs(dx) < Math.abs(dy) * 1.4) return 0;
|
||||
const distance = Math.abs(dx);
|
||||
const deliberate = distance >= Math.min(90, Math.max(55, width * 0.18));
|
||||
const flick = distance >= 36 && distance / Math.max(1, elapsed) >= 0.5;
|
||||
return deliberate || flick ? (dx < 0 ? 1 : -1) : 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue