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

Method _hasStartOverflow

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

Source from the content-addressed store, hash-verified

1150 }
1151
1152 _hasStartOverflow(containerWidth: number, itemsDomRefs: Array<TabInStrip | TabSeparatorInStrip>, selectedItemIndexAndWidth: { width: number; index: number}) {
1153 if (this._getStartOverflow().textContent !== "+0") {
1154 return true;
1155 }
1156
1157 if (selectedItemIndexAndWidth.index === 0) {
1158 return false;
1159 }
1160
1161 let leftItemsWidth = 0;
1162
1163 for (let i = selectedItemIndexAndWidth.index - 1; i >= 0; i--) {
1164 leftItemsWidth += this._getItemWidth(itemsDomRefs[i]);
1165 }
1166
1167 let hasStartOverflow = containerWidth < leftItemsWidth + selectedItemIndexAndWidth.width;
1168
1169 // if there is no "start" overflow, it has "end" overflow
1170 // check it again with the "end" overflow
1171 if (!hasStartOverflow) {
1172 this._getEndOverflow().removeAttribute("hidden");
1173 containerWidth = this._getTabStrip().offsetWidth;
1174 hasStartOverflow = containerWidth < leftItemsWidth + selectedItemIndexAndWidth.width;
1175 this._getEndOverflow().setAttribute("hidden", "");
1176 }
1177
1178 return hasStartOverflow;
1179 }
1180
1181 _hasEndOverflow(containerWidth: number, itemsDomRefs: Array<TabInStrip | TabSeparatorInStrip>, selectedItemIndexAndWidth: { width: number; index: number}) {
1182 if (selectedItemIndexAndWidth.index >= itemsDomRefs.length) {

Callers 1

Calls 4

_getStartOverflowMethod · 0.95
_getItemWidthMethod · 0.95
_getEndOverflowMethod · 0.95
_getTabStripMethod · 0.95

Tested by

no test coverage detected