Skip to content

Commit

Permalink
fix: Tabs flicker in zoom mode
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Sep 29, 2024
1 parent 2648b6d commit 0ad7af4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/TabNavList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const TabNavList = React.forwardRef<HTMLDivElement, TabNavListProps>((props, ref
const addSizeValue = getUnitValue(addSize, tabPositionTopOrBottom);
const operationSizeValue = getUnitValue(operationSize, tabPositionTopOrBottom);

const needScroll = containerExcludeExtraSizeValue < tabContentSizeValue + addSizeValue;
const needScroll = Math.floor(containerExcludeExtraSizeValue) < Math.floor(tabContentSizeValue + addSizeValue);
const visibleTabContentValue = needScroll
? containerExcludeExtraSizeValue - operationSizeValue
: containerExcludeExtraSizeValue - addSizeValue;
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useVisibleRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function useVisibleRange(
let endIndex = len;
for (let i = 0; i < len; i += 1) {
const offset = tabOffsets.get(tabs[i].key) || DEFAULT_SIZE;
if (offset[position] + offset[charUnit] > transformSize + visibleTabContentValue) {
if (Math.floor(offset[position] + offset[charUnit]) > Math.floor(transformSize + visibleTabContentValue)) {
endIndex = i - 1;
break;
}
Expand Down

0 comments on commit 0ad7af4

Please sign in to comment.