From 5b7cfe25bc2709df2097763b80b4ae9264059972 Mon Sep 17 00:00:00 2001 From: hzsrc Date: Fri, 16 Aug 2024 19:37:23 +0800 Subject: [PATCH] fix: use getPixelRatio() --- src/util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.ts b/src/util.ts index dc32da89..61fbebcd 100644 --- a/src/util.ts +++ b/src/util.ts @@ -210,7 +210,7 @@ export async function nodeToDataURL( const foreignObject = document.createElementNS(xmlns, 'foreignObject') // fix: if ratio=2 and style.border='1px', in html it is actually rendered to 1px, but in it is rendered to 2px. Then height is different and the bottom 1px is lost, 10 nodes will lost 10px. - var ratio = self.devicePixelRatio; + var ratio = getPixelRatio(); svg.setAttribute('width', `${width / ratio}`) svg.setAttribute('height', `${height / ratio}`) svg.setAttribute('viewBox', `0 0 ${width} ${height}`)