From c9c2e9ea3c22433a7971ed8ff24b4b4425b1cf3a Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Thu, 11 Feb 2021 18:06:23 -0500 Subject: [PATCH] Move "zero size SVG" comment for clarity --- src/SVGSkin.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SVGSkin.js b/src/SVGSkin.js index 5f3cf0833..2acdf7bfd 100644 --- a/src/SVGSkin.js +++ b/src/SVGSkin.js @@ -106,12 +106,13 @@ class SVGSkin extends Skin { const {width, height} = this._svgMeasurements; this._canvas.width = width * scale; this._canvas.height = height * scale; - // Even if the canvas at the current scale has a nonzero size, the image's dimensions are floored pre-scaling. - // e.g. if an image has a width of 0.4 and is being rendered at 3x scale, the canvas will have a width of 1, but - // the image's width will be rounded down to 0 on some browsers (Firefox) prior to being drawn at that scale. if ( this._canvas.width <= 0 || this._canvas.height <= 0 || + // Even if the canvas at the current scale has a nonzero size, the image's dimensions are floored + // pre-scaling; e.g. if an image has a width of 0.4 and is being rendered at 3x scale, the canvas will have + // a width of 1, but the image's width will be rounded down to 0 on some browsers (Firefox) prior to being + // drawn at that scale, resulting in an IndexSizeError if we attempt to draw it. this._svgImage.naturalWidth <= 0 || this._svgImage.naturalHeight <= 0 ) return super.getTexture();