fix(h5): prioritize horizontal report image gestures
This commit is contained in:
+1
-1
@@ -1521,7 +1521,7 @@
|
||||
viewport.style.height = (panels[lower].offsetHeight * (1 - ratio) + panels[upper].offsetHeight * ratio) + 'px';
|
||||
}
|
||||
var swipe = SwipeTrack.create(viewport, track, { count: panels.length, gestureTarget: card,
|
||||
gestureSelector: '.viz-frame', startThreshold: 12, directionRatio: 1.5, maxOverscroll: 16,
|
||||
gestureSelector: '.viz-frame', startThreshold: 12, directionRatio: 2 / 3, maxOverscroll: 16,
|
||||
onStart: function () { viewport.style.height = viewport.getBoundingClientRect().height + 'px'; },
|
||||
onCancel: height, onSelect: function (i) { setDetailTab(card, String(i)); } });
|
||||
detailSwipes.set(card, { swipe: swipe, height: height });
|
||||
|
||||
@@ -34,8 +34,8 @@ window.SwipeTrack = (function () {
|
||||
if (!drag.horizontal) {
|
||||
var threshold = options.startThreshold || 8, ratio = options.directionRatio || 1;
|
||||
if (Math.max(Math.abs(dx), Math.abs(dy)) <= threshold) return;
|
||||
// Ambiguous diagonal movement belongs to page scrolling. Once locked,
|
||||
// neither direction can steal this gesture before the finger lifts.
|
||||
// Each caller chooses its diagonal bias. Once locked, neither direction
|
||||
// can steal this gesture before the finger lifts.
|
||||
if (Math.abs(dy) * ratio >= Math.abs(dx)) { drag.vertical = true; return; }
|
||||
drag.horizontal = true;
|
||||
if (options.onStart) options.onStart(index);
|
||||
|
||||
@@ -120,7 +120,8 @@ try {
|
||||
await drag(card, 25, { pause: 160 }); assert.equal(await selected(card), '1', 'short slow drag snaps back');
|
||||
await drag(card, 100, { cancel: true }); assert.equal(await selected(card), '1', 'cancellation restores selection');
|
||||
await drag(card, 2, { dy: -90 }); assert.equal(await selected(card), '1', 'vertical scrolling preserves tab');
|
||||
await drag(card, 65, { dy: -60 }); assert.equal(await selected(card), '1', 'ambiguous diagonal scrolling does not switch tabs');
|
||||
await drag(card, 65, { dy: -60 }); assert.equal(await selected(card), '0', 'diagonal image gesture prioritizes horizontal switching');
|
||||
await card.locator('.dtab').nth(1).click(); await page.waitForTimeout(400);
|
||||
await drag(card, 100, { text: true }); assert.equal(await selected(card), '1', 'horizontal dragging on analysis text does not switch tabs');
|
||||
await drag(card, 2, { dy: -90, text: true }); assert.equal(await selected(card), '1', 'reading text keeps vertical scrolling and current tab');
|
||||
await drag(card, 40, { flick: true }); assert.equal(await selected(card), '0', 'short fast flick goes back');
|
||||
|
||||
Reference in New Issue
Block a user