MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / _getClipping

Method _getClipping

src/dd-draggable.ts:443–453  ·  view source on GitHub ↗

@internal compute how many pixels the element is clipped: negative = above, positive = below, 0 = fully inside OR outside (stop scrolling)

(el: HTMLElement, scrollEl: HTMLElement)

Source from the content-addressed store, hash-verified

441
442 /** @internal compute how many pixels the element is clipped: negative = above, positive = below, 0 = fully inside OR outside (stop scrolling) */
443 protected _getClipping(el: HTMLElement, scrollEl: HTMLElement): number {
444 const elRect = el.getBoundingClientRect();
445 const scrollRect = scrollEl.getBoundingClientRect();
446 const viewportH = window.innerHeight || document.documentElement.clientHeight;
447 if (elRect.bottom < scrollRect.top || elRect.top > scrollRect.bottom) return 0; // fully outside
448 const clippedBelow = elRect.bottom - Math.min(scrollRect.bottom, viewportH);
449 const clippedAbove = elRect.top - Math.max(scrollRect.top, 0);
450 if (clippedAbove < 0) return clippedAbove;
451 if (clippedBelow > 0) return clippedBelow;
452 return 0;
453 }
454
455 /** @internal single tick of the auto-scroll animation loop */
456 protected _autoScrollTick = (): void => {

Callers 2

updateScrollPositionMethod · 0.95
DDDraggableClass · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected