Merge pull request #260 from kchadha/get-rotation-center

getSkinRotationCenter API and support for new scratch-svg-renderer
This commit is contained in:
kchadha
2018-04-23 15:55:10 -04:00
committed by GitHub
5 changed files with 14 additions and 4 deletions

View File

@@ -42,7 +42,7 @@
"json": "^9.0.4",
"linebreak": "0.3.0",
"raw-loader": "^0.5.1",
"scratch-svg-renderer": "0.1.0-prerelease.20180329174139",
"scratch-svg-renderer": "0.1.0-prerelease.20180423193917",
"tap": "^11.0.0",
"travis-after-all": "^1.4.4",
"twgl.js": "4.4.0",

View File

@@ -90,7 +90,7 @@ class BitmapSkin extends Skin {
}
// Do these last in case any of the above throws an exception
this._costumeResolution = costumeResolution || 1;
this._costumeResolution = costumeResolution || 2;
this._textureSize = BitmapSkin._getBitmapSize(bitmapData);
if (typeof rotationCenter === 'undefined') rotationCenter = this.calculateRotationCenter();

View File

@@ -493,6 +493,16 @@ class RenderWebGL extends EventEmitter {
return skin.size;
}
/**
* Get the rotation center of a skin by ID.
* @param {int} skinID The ID of the Skin
* @return {Array<number>} The rotationCenterX and rotationCenterY
*/
getSkinRotationCenter (skinID) {
const skin = this._allSkins[skinID];
return skin.calculateRotationCenter();
}
/**
* Check if a particular Drawable is touching a particular color.
* Unlike touching drawable, touching color tests invisible sprites.

View File

@@ -2,7 +2,7 @@ const twgl = require('twgl.js');
const Silhouette = require('./Silhouette');
const Skin = require('./Skin');
const SvgRenderer = require('scratch-svg-renderer');
const SvgRenderer = require('scratch-svg-renderer').SVGRenderer;
const MAX_TEXTURE_DIMENSION = 2048;

View File

@@ -1,5 +1,5 @@
const SVGTextWrapper = require('./svg-text-wrapper');
const SvgRenderer = require('scratch-svg-renderer');
const SvgRenderer = require('scratch-svg-renderer').SVGRenderer;
const xmlescape = require('xml-escape');
const MAX_LINE_LENGTH = 170;