Merge pull request #5481 from opf/bug-wp-table-horizontal-scrolling-sync-25226

Fixes wrong horizontal scroll sync

[ci skip]
pull/5494/head
Oliver Günther 8 years ago committed by GitHub
commit f8fc2514f3
  1. 9
      frontend/app/components/wp-table/wp-table-scroll-sync.ts

@ -63,6 +63,7 @@ function getPlattformAgnosticScrollAmount(originalValue: number) {
}
function syncWheelEvent(jev: JQueryEventObject, elementTable: JQuery, elementTimeline: JQuery) {
const scrollTarget = jev.target;
const ev: WheelEvent = jev.originalEvent as any;
let [deltaX, deltaY] = getXandYScrollDeltas(ev);
@ -71,14 +72,14 @@ function syncWheelEvent(jev: JQueryEventObject, elementTable: JQuery, elementTim
}
ev.preventDefault();
deltaX = getPlattformAgnosticScrollAmount(deltaX);
deltaY = getPlattformAgnosticScrollAmount(deltaY);
deltaX = getPlattformAgnosticScrollAmount(deltaX); // apply only in target div
deltaY = getPlattformAgnosticScrollAmount(deltaY); // apply in both divs
window.requestAnimationFrame(function () {
elementTable[0].scrollTop = elementTable[0].scrollTop + deltaY;
elementTable[0].scrollLeft = elementTable[0].scrollLeft + deltaX;
elementTimeline[0].scrollTop = elementTimeline[0].scrollTop + deltaY;
elementTimeline[0].scrollLeft = elementTimeline[0].scrollLeft + deltaX;
scrollTarget.scrollLeft = scrollTarget.scrollLeft + deltaX;
});
}

Loading…
Cancel
Save