fix(tab-row): Fix extra +1 when extraWidthRemaining is a decimal

This commit is contained in:
SiriusXT 2025-06-06 15:55:00 +08:00
parent a38c091d73
commit 537ad1c1e5

View File

@ -510,11 +510,11 @@ export default class TabRowWidget extends BasicWidget {
let extraWidthRemaining = totalExtraWidthDueToFlooring;
for (let i = 0; i < numberOfTabs; i += 1) {
const extraWidth = flooredClampedTargetWidth < TAB_CONTAINER_MAX_WIDTH && extraWidthRemaining > 0 ? 1 : 0;
const extraWidth = flooredClampedTargetWidth < TAB_CONTAINER_MAX_WIDTH && extraWidthRemaining >= 1 ? 1 : 0;
widths.push(flooredClampedTargetWidth + extraWidth);
if (extraWidthRemaining > 0) {
if (extraWidthRemaining >= 1) {
extraWidthRemaining -= 1;
}
}