Skip to content

Commit

Permalink
fix: Math.round img dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier committed Aug 29, 2024
1 parent 0a6670a commit 0f93e64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/mdx/Img/Img.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export async function Img({
const ratio = w && h ? w / h : undefined

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

return (
Expand Down

0 comments on commit 0f93e64

Please sign in to comment.