Merge pull request #90 from cwillisf/fix-cachalot
SVG: compensate for viewbox offset
This commit is contained in:
@@ -40,6 +40,16 @@ class SVGSkin extends Skin {
|
||||
return this._svgRenderer.size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the origin, in object space, about which this Skin should rotate.
|
||||
* @param {number} x - The x coordinate of the new rotation center.
|
||||
* @param {number} y - The y coordinate of the new rotation center.
|
||||
*/
|
||||
setRotationCenter (x, y) {
|
||||
const viewOffset = this._svgRenderer.viewOffset;
|
||||
super.setRotationCenter(x - viewOffset[0], y - viewOffset[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {[number,number]} scale - The scaling factors to be used.
|
||||
* @return {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
|
||||
|
||||
@@ -80,6 +80,13 @@ class SvgRenderer {
|
||||
return [this._measurements.width, this._measurements.height];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {[number,number]} the offset (upper left corner) of the SVG's view box.
|
||||
*/
|
||||
get viewOffset () {
|
||||
return [this._measurements.x, this._measurements.y];
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms an SVG's text elements for Scratch 2.0 quirks.
|
||||
* These quirks include:
|
||||
|
||||
Reference in New Issue
Block a user