Skip to content

Commit 0f93e64

Browse files
committed
fix: Math.round img dimension
1 parent 0a6670a commit 0f93e64

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/mdx/Img/Img.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export async function Img({
2727
const ratio = w && h ? w / h : undefined
2828

2929
// If only one dimension is provided, calculate the other based on the image's aspect ratio
30-
dims.width ??= height && ratio ? Number(height) * ratio : w
31-
dims.height ??= width && ratio ? Number(width) / ratio : h
30+
dims.width ??= height && ratio ? Math.round(Number(height) * ratio) : w
31+
dims.height ??= width && ratio ? Math.round(Number(width) / ratio) : h
3232
}
3333

3434
return (

0 commit comments

Comments
 (0)