Fix SVG size calculation

It was being incorrectly calculated based on devicePixelRatio.

Fixes LLK/scratch-gui#73. Thanks to @cwillisf for figuring it out!
This commit is contained in:
Ray Schamp 2017-02-06 20:00:52 -05:00
parent c3c7bb28ae
commit 9a8f4f2a88
2 changed files with 9 additions and 2 deletions

View File

@ -34,10 +34,10 @@ class SVGSkin extends Skin {
}
/**
* @return {[number,number]} the "native" size, in texels, of this skin.
* @return {[number,number]} the natural size, in Scratch units, of this skin.
*/
get size () {
return [this._svgRenderer.canvas.width, this._svgRenderer.canvas.height];
return this._svgRenderer.size;
}
/**

View File

@ -72,6 +72,13 @@ class SvgRenderer {
this._draw();
}
/**
* @return {[number,number]} the natural size, in Scratch units, of this SVG.
*/
get size () {
return [this._measurements.width, this._measurements.height];
}
/**
* Transforms an SVG's text elements for Scratch 2.0 quirks.
* These quirks include: