MCPcopy Create free account
hub / github.com/angular/components / _isOutOfView

Method _isOutOfView

docs/src/app/shared/carousel/carousel.ts:147–158  ·  view source on GitHub ↗

Checks whether an item at a specific index is outside of the viewport.

(index: number, side?: 'start' | 'end')

Source from the content-addressed store, hash-verified

145
146 /** Checks whether an item at a specific index is outside of the viewport. */
147 private _isOutOfView(index: number, side?: 'start' | 'end') {
148 const {offsetWidth, offsetLeft} = this.items()[index].element.nativeElement;
149
150 if ((!side || side === 'start') && offsetLeft - this.position < 0) {
151 return true;
152 }
153
154 return (
155 (!side || side === 'end') &&
156 offsetWidth + offsetLeft - this.position > this.list().nativeElement.clientWidth
157 );
158 }
159}

Callers 4

onKeydownMethod · 0.95
nextMethod · 0.95
previousMethod · 0.95
_scrollToActiveItemMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected