diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.js | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -3711,9 +3711,17 @@ function balanceCard() { onTouchstart: (e) => { const el = e.currentTarget; el._dragging = true; _carDragging = true; el._skipMorph = true; - el._x0 = el.scrollLeft; // where the finger found it — a tap leaves this alone + // where the finger landed, and where it found the strip — a tap + // moves neither + el._x0 = el.scrollLeft; + el._tx = (e.touches[0] || {}).clientX || 0; + el._moved = false; clearTimeout(el._settle); }, + onTouchmove: (e) => { + const el = e.currentTarget; + if (!el._moved && Math.abs(((e.touches[0] || {}).clientX || 0) - (el._tx || 0)) > 4) el._moved = true; + }, onTouchend: (e) => { const el = e.currentTarget; el._dragging = false; // onScroll's debounce settles it @@ -3724,7 +3732,7 @@ function balanceCard() { // the unit tag on a phone took most of a second to change the number // while the same tap on a laptop (the mouse path has always had this // guard) was instant. - if (Math.abs(el.scrollLeft - (el._x0 || 0)) < 2) { endCarouselDrag(); return; } + if (!el._moved && Math.abs(el.scrollLeft - (el._x0 || 0)) < 2) { endCarouselDrag(); return; } // The finger is up: lift the render hold (the strip stays frozen via // _skipMorph) and commit the predicted landing NOW, so the history // below loads under the glide instead of after it. |
