Skip to content

Commit

Permalink
fix: img missing alt
Browse files Browse the repository at this point in the history
  • Loading branch information
hzsrc committed Aug 17, 2024
1 parent 8ea57e6 commit 56b099e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export async function nodeToDataURL(
const svg = document.createElementNS(xmlns, 'svg')
const foreignObject = document.createElementNS(xmlns, 'foreignObject')

// fix: if ratio=2 and style.border='1px', in html it is actually rendered to 1px, but in <img src="svg"> it is rendered to 2px. Then height is different and the bottom 1px is lost, 10 nodes will lost 10px.
// fix: if ratio=2 and style.border='1px', in html it is actually rendered to 1px, but in <img src="svg" alt="i"> it is rendered to 2px. Then height is different and the bottom 1px is lost, 10 nodes will lost 10px.
const ratio = getPixelRatio()
svg.setAttribute('width', `${width / ratio}`)
svg.setAttribute('height', `${height / ratio}`)
Expand Down

0 comments on commit 56b099e

Please sign in to comment.