MCPcopy Index your code
hub / github.com/SortableJS/Sortable / getRelativeScrollOffset

Function getRelativeScrollOffset

src/utils.js:396–413  ·  view source on GitHub ↗

* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements. * The value is returned in real pixels. * @param {HTMLElement} el * @return {Array} Offsets in the format of [left, top]

(el)

Source from the content-addressed store, hash-verified

394 * @return {Array} Offsets in the format of [left, top]
395 */
396function getRelativeScrollOffset(el) {
397 let offsetLeft = 0,
398 offsetTop = 0,
399 winScroller = getWindowScrollingElement();
400
401 if (el) {
402 do {
403 let elMatrix = matrix(el),
404 scaleX = elMatrix.a,
405 scaleY = elMatrix.d;
406
407 offsetLeft += el.scrollLeft * scaleX;
408 offsetTop += el.scrollTop * scaleY;
409 } while (el !== winScroller && (el = el.parentNode));
410 }
411
412 return [offsetLeft, offsetTop];
413}
414
415/**
416 * Returns the index of the object within the given array

Callers 1

Sortable.jsFile · 0.90

Calls 2

matrixFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…