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

Function _getOptionScrollPosition

src/material/core/option/option.ts:330–345  ·  view source on GitHub ↗
(
  optionOffset: number,
  optionHeight: number,
  currentScrollPosition: number,
  panelHeight: number,
)

Source from the content-addressed store, hash-verified

328 * @docs-private
329 */
330export function _getOptionScrollPosition(
331 optionOffset: number,
332 optionHeight: number,
333 currentScrollPosition: number,
334 panelHeight: number,
335): number {
336 if (optionOffset < currentScrollPosition) {
337 return optionOffset;
338 }
339
340 if (optionOffset + optionHeight > currentScrollPosition + panelHeight) {
341 return Math.max(0, optionOffset - panelHeight + optionHeight);
342 }
343
344 return currentScrollPosition;
345}

Callers 2

_scrollToOptionMethod · 0.90
_scrollOptionIntoViewMethod · 0.90

Calls 1

maxMethod · 0.45

Tested by

no test coverage detected