mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-15 18:59:33 +01:00
fix(mobile): hand a swipe-locked drag back to the scroll past the swipe's drift limit
A scroll whose first move past the tap slop leaned sideways (a thumb arc) locked as 'swipe' for the whole contact, and SwipeHandler drops a swipe at 50 px of vertical drift, so the gesture did nothing. Past that limit the drag is now a 'y' scroll. Also brings the mobile-handlers fileoverview to the current 500 ms / 50 px limits and notes in the Mobile Guide that a selection pauses the swipe and a wide terminal pans instead.
This commit is contained in:
1 parent
63cada938d
commit
e8fc08beb3
4 files changed
+30
-5
No files matched your search
@@ -147,6 +147,18 @@ describe('terminal touch handler hands sideways drags to the swipe', () => {
|
||||
expect(TERMINAL_SOURCE).toContain("panAxis = travelX > travelY ? (canPanHorizontally() ? 'x' : 'swipe') : 'y';");
|
||||
expect(TERMINAL_SOURCE).toContain('this._terminalGestureAxis = panAxis;');
|
||||
// A 'swipe' is neither a scroll nor (didScroll is set) a tap.
|
||||
expect(TERMINAL_SOURCE).toContain("if (panAxis === 'swipe') return;");
|
||||
expect(TERMINAL_SOURCE).toContain("if (panAxis === 'swipe') {");
|
||||
});
|
||||
|
||||
it("hands a 'swipe' drag back to the scroll once it passes the swipe's own drift limit", () => {
|
||||
// A thumb arc whose first move leans sideways (+9 px across, +5 px down) locks
|
||||
// as 'swipe'; SwipeHandler drops it past maxVerticalDrift, so without the
|
||||
// handback the 300 px of downward travel that follows would do nothing.
|
||||
const start = TERMINAL_SOURCE.indexOf("if (panAxis === 'swipe') {");
|
||||
const block = TERMINAL_SOURCE.slice(start, TERMINAL_SOURCE.indexOf("if (panAxis === 'x') {", start));
|
||||
expect(block).toContain('SwipeHandler.maxVerticalDrift');
|
||||
expect(block).toContain('if (Math.abs(touchY - touchStartY) <= drift) return;');
|
||||
expect(block).toContain("panAxis = 'y';");
|
||||
expect(block).toContain("this._terminalGestureAxis = 'y';");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user