Skip to content

Commit 16d9461

Browse files
committed
chore: not align if no need
1 parent a73beef commit 16d9461

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/hooks/useAlign.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ export default function useAlign(
199199
Math.round((eleRect.height / eleOutHeight) * 1000) / 1000,
200200
);
201201

202+
// No need to align since it's not visible in view
203+
if (scaleX === 0 || scaleY === 0) {
204+
return;
205+
}
206+
202207
const eleScrollWidth = (eleOutWidth - eleInnerWidth) * scaleX;
203208
const eleScrollHeight = (eleOutHeight - eleInnerHeight) * scaleY;
204209
const eleRight = eleRect.x + eleRect.width - eleScrollWidth;

0 commit comments

Comments
 (0)