(dir)
| 127 | // One gesture = one page change. The lock absorbs trackpad inertia |
| 128 | // (which fires a burst of +/- deltas) so the page can't flip-flop. |
| 129 | const go = (dir) => { |
| 130 | if (lock) return; |
| 131 | setPageIndex((cur) => { |
| 132 | const next = Math.min(Math.max(cur + (dir > 0 ? 1 : -1), 0), PAGE_COUNT - 1); |
| 133 | if (cur === next) return cur; |
| 134 | lock = true; |
| 135 | setTimeout(() => { |
| 136 | lock = false; |
| 137 | }, 1000); |
| 138 | return next; |
| 139 | }); |
| 140 | }; |
| 141 | // when the active screen's own content overflows, let it scroll natively |
| 142 | // until it hits the edge — only then do we snap to the next/prev screen |
| 143 | const canScrollWithin = (dir) => { |
no outgoing calls
no test coverage detected