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

Function getRelativeScrollOffset

modular/sortable.core.esm.js:407–421  ·  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

405 * @return {Array} Offsets in the format of [left, top]
406 */
407function getRelativeScrollOffset(el) {
408 var offsetLeft = 0,
409 offsetTop = 0,
410 winScroller = getWindowScrollingElement();
411 if (el) {
412 do {
413 var elMatrix = matrix(el),
414 scaleX = elMatrix.a,
415 scaleY = elMatrix.d;
416 offsetLeft += el.scrollLeft * scaleX;
417 offsetTop += el.scrollTop * scaleY;
418 } while (el !== winScroller && (el = el.parentNode));
419 }
420 return [offsetLeft, offsetTop];
421}
422
423/**
424 * Returns the index of the object within the given array

Callers 1

Calls 2

matrixFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…