FXL: fix getting viewport from SVGs

This commit is contained in:
John Factotum
2023-10-08 20:40:16 +08:00
parent 7a31359cd4
commit 819106c71f
+1 -1
View File
@@ -5,7 +5,7 @@ const parseViewport = str => str
const getViewport = (doc, viewport) => { const getViewport = (doc, viewport) => {
// use `viewBox` for SVG // use `viewBox` for SVG
if (doc.documentElement.nodeName === 'svg') { if (doc.documentElement.localName === 'svg') {
const [, , width, height] = doc.documentElement const [, , width, height] = doc.documentElement
.getAttribute('viewBox')?.split(/\s/) ?? [] .getAttribute('viewBox')?.split(/\s/) ?? []
return { width, height } return { width, height }