@ajuarezso/sui-design-system 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14619,6 +14619,11 @@ class SuiTable {
|
|
|
14619
14619
|
});
|
|
14620
14620
|
}
|
|
14621
14621
|
bindTouchScroll(el) {
|
|
14622
|
+
/* X NATIVO también en Android: el bug de Chromium es solo con el gesto
|
|
14623
|
+
VERTICAL (no delega al scroll de la página). `touch-action: pan-x` deja
|
|
14624
|
+
que el browser haga el pan/fling horizontal nativo (fluido de verdad) y
|
|
14625
|
+
nos entrega los gestos verticales para manejarlos por JS. */
|
|
14626
|
+
el.style.touchAction = 'pan-x';
|
|
14622
14627
|
let sx = 0, sy = 0, lx = 0, ly = 0;
|
|
14623
14628
|
let axis = null;
|
|
14624
14629
|
let pageScroller = null;
|
|
@@ -14626,7 +14631,7 @@ class SuiTable {
|
|
|
14626
14631
|
ventana de samples (~100ms) tipo VelocityTracker de Android — NO con el
|
|
14627
14632
|
último move suelto: el dedo siempre desacelera antes de soltar, así que
|
|
14628
14633
|
la velocidad instantánea final es ~0 y el fling moría → scroll "lento". */
|
|
14629
|
-
let vy = 0,
|
|
14634
|
+
let vy = 0, momentumRaf = 0, momentumTs = 0;
|
|
14630
14635
|
const samples = [];
|
|
14631
14636
|
const VELOCITY_WINDOW_MS = 100;
|
|
14632
14637
|
const findPageScroller = () => {
|
|
@@ -14679,9 +14684,13 @@ class SuiTable {
|
|
|
14679
14684
|
axis = canScrollX && dx > dy ? 'x' : 'y';
|
|
14680
14685
|
}
|
|
14681
14686
|
if (axis === 'x') {
|
|
14682
|
-
|
|
14687
|
+
/* Horizontal: NO interceptar — con touch-action:pan-x el browser hace el
|
|
14688
|
+
scroll X nativo (momentum incluido). Solo actualizamos refs. */
|
|
14689
|
+
lx = t.clientX;
|
|
14690
|
+
ly = t.clientY;
|
|
14691
|
+
return;
|
|
14683
14692
|
}
|
|
14684
|
-
|
|
14693
|
+
if (pageScroller) {
|
|
14685
14694
|
pageScroller.scrollTop -= t.clientY - ly;
|
|
14686
14695
|
}
|
|
14687
14696
|
samples.push({ x: t.clientX, y: t.clientY, t: e.timeStamp });
|
|
@@ -14701,23 +14710,6 @@ class SuiTable {
|
|
|
14701
14710
|
const first = samples[0];
|
|
14702
14711
|
const last = samples[samples.length - 1];
|
|
14703
14712
|
const win = last && first ? last.t - first.t : 0;
|
|
14704
|
-
if (axis === 'x') {
|
|
14705
|
-
vx = win > 0 ? (last.x - first.x) / win : 0;
|
|
14706
|
-
if (Math.abs(vx) < 0.05)
|
|
14707
|
-
return;
|
|
14708
|
-
momentumTs = 0;
|
|
14709
|
-
const stepX = (ts) => {
|
|
14710
|
-
if (!momentumTs)
|
|
14711
|
-
momentumTs = ts;
|
|
14712
|
-
const dt = Math.min(ts - momentumTs, 32);
|
|
14713
|
-
momentumTs = ts;
|
|
14714
|
-
el.scrollLeft -= vx * dt;
|
|
14715
|
-
vx *= Math.pow(0.95, dt / 16);
|
|
14716
|
-
momentumRaf = Math.abs(vx) > 0.02 ? requestAnimationFrame(stepX) : 0;
|
|
14717
|
-
};
|
|
14718
|
-
momentumRaf = requestAnimationFrame(stepX);
|
|
14719
|
-
return;
|
|
14720
|
-
}
|
|
14721
14713
|
if (!pageScroller)
|
|
14722
14714
|
return;
|
|
14723
14715
|
vy = win > 0 ? (last.y - first.y) / win : 0;
|