Merge pull request #181 from paulkaplan/fix-stroke-measurement

Use zero if cannot parse stroke width
This commit is contained in:
Paul Kaplan
2017-10-12 16:33:09 -04:00
committed by GitHub

View File

@@ -197,7 +197,10 @@ class SvgRenderer {
largestStrokeWidth = Math.max(largestStrokeWidth, 1); largestStrokeWidth = Math.max(largestStrokeWidth, 1);
} }
if (domElement.getAttribute('stroke-width')) { if (domElement.getAttribute('stroke-width')) {
largestStrokeWidth = Math.max(largestStrokeWidth, Number(domElement.getAttribute('stroke-width'))); largestStrokeWidth = Math.max(
largestStrokeWidth,
Number(domElement.getAttribute('stroke-width')) || 0
);
} }
} }
for (let i = 0; i < domElement.childNodes.length; i++) { for (let i = 0; i < domElement.childNodes.length; i++) {