MCPcopy Create free account
hub / github.com/UI5/webcomponents / _findFirstVisibleItem

Method _findFirstVisibleItem

packages/main/src/TabContainer.ts:1244–1263  ·  view source on GitHub ↗
(itemsDomRefs: Array<TabInStrip | TabSeparatorInStrip>, containerWidth: number, selectedItemWidth: number, startIndex?: number)

Source from the content-addressed store, hash-verified

1242 }
1243
1244 _findFirstVisibleItem(itemsDomRefs: Array<TabInStrip | TabSeparatorInStrip>, containerWidth: number, selectedItemWidth: number, startIndex?: number) {
1245 if (startIndex === undefined) {
1246 startIndex = itemsDomRefs.length - 1;
1247 }
1248
1249 let lastVisible = startIndex + 1;
1250
1251 for (let index = startIndex; index >= 0; index--) {
1252 const itemWidth = this._getItemWidth(itemsDomRefs[index]);
1253
1254 if (containerWidth < selectedItemWidth + itemWidth) {
1255 break;
1256 }
1257
1258 selectedItemWidth += itemWidth;
1259 lastVisible = index;
1260 }
1261
1262 return lastVisible;
1263 }
1264
1265 _findLastVisibleItem(itemsDomRefs: Array<TabInStrip | TabSeparatorInStrip>, containerWidth: number, selectedItemWidth: number, startIndex = 0) {
1266 let lastVisibleIndex = startIndex - 1;

Callers 1

Calls 1

_getItemWidthMethod · 0.95

Tested by

no test coverage detected