fix(h5): reduce report swipe conflicts and limit edge overscroll

This commit is contained in:
xsl
2026-10-13 00:24:52 +08:00
parent f1e64565b9
commit 3efa28b311
10 changed files with 858 additions and 757 deletions
+6 -1
View File
@@ -1513,12 +1513,17 @@
panels[i].setAttribute('role', 'tabpanel'); panels[i].setAttribute('aria-labelledby', tab.id);
});
function height(at) {
// Fonts/images may resize while dragging. Keep the current card height
// until release so the rest of the report does not move under the finger.
if (swipe && swipe.isDragging()) return;
position = at;
var lower = Math.floor(at), upper = Math.min(panels.length - 1, Math.ceil(at)), ratio = at - lower;
viewport.style.height = (panels[lower].offsetHeight * (1 - ratio) + panels[upper].offsetHeight * ratio) + 'px';
}
var swipe = SwipeTrack.create(viewport, track, { count: panels.length, gestureTarget: card,
onMove: height, onCancel: height, onSelect: function (i) { setDetailTab(card, String(i)); } });
gestureSelector: '.viz-frame', startThreshold: 12, directionRatio: 1.5, 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 });
setDetailTab(card, '0', true);
if (typeof ResizeObserver !== 'undefined') {