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

Function isScrolledPast

modular/sortable.core.esm.js:321–339  ·  view source on GitHub ↗

* Checks if a side of an element is scrolled past a side of its parents * @param {HTMLElement} el The element who's side being scrolled out of view is in question * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom') * @param {String

(el, elSide, parentSide)

Source from the content-addressed store, hash-verified

319 * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
320 */
321function isScrolledPast(el, elSide, parentSide) {
322 var parent = getParentAutoScrollElement(el, true),
323 elSideVal = getRect(el)[elSide];
324
325 /* jshint boss:true */
326 while (parent) {
327 var parentSideVal = getRect(parent)[parentSide],
328 visible = void 0;
329 if (parentSide === 'top' || parentSide === 'left') {
330 visible = elSideVal >= parentSideVal;
331 } else {
332 visible = elSideVal <= parentSideVal;
333 }
334 if (!visible) return parent;
335 if (parent === getWindowScrollingElement()) break;
336 parent = getParentAutoScrollElement(parent, false);
337 }
338 return false;
339}
340
341/**
342 * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)

Callers 1

Calls 3

getRectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…