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

Method _hasEndOverflow

packages/main/src/TabContainer.ts:1181–1204  ·  view source on GitHub ↗
(containerWidth: number, itemsDomRefs: Array<TabInStrip | TabSeparatorInStrip>, selectedItemIndexAndWidth: { width: number; index: number})

Source from the content-addressed store, hash-verified

1179 }
1180
1181 _hasEndOverflow(containerWidth: number, itemsDomRefs: Array<TabInStrip | TabSeparatorInStrip>, selectedItemIndexAndWidth: { width: number; index: number}) {
1182 if (selectedItemIndexAndWidth.index >= itemsDomRefs.length) {
1183 return false;
1184 }
1185
1186 let rightItemsWidth = 0;
1187
1188 for (let i = selectedItemIndexAndWidth.index; i < itemsDomRefs.length; i++) {
1189 rightItemsWidth += this._getItemWidth(itemsDomRefs[i]);
1190 }
1191
1192 let hasEndOverflow = containerWidth < rightItemsWidth + selectedItemIndexAndWidth.width;
1193
1194 // if there is no "end" overflow, it has "start" overflow
1195 // check it again with the "start" overflow
1196 if (!hasEndOverflow) {
1197 this._getStartOverflow().removeAttribute("hidden");
1198 containerWidth = this._getTabStrip().offsetWidth;
1199 hasEndOverflow = containerWidth < rightItemsWidth + selectedItemIndexAndWidth.width;
1200 this._getStartOverflow().setAttribute("hidden", "");
1201 }
1202
1203 return hasEndOverflow;
1204 }
1205
1206 _getItemWidth(itemDomRef: HTMLElement) {
1207 const styles = window.getComputedStyle(itemDomRef);

Callers 1

Calls 3

_getItemWidthMethod · 0.95
_getStartOverflowMethod · 0.95
_getTabStripMethod · 0.95

Tested by

no test coverage detected