Add updating the rotation center to updateSvg

This commit is contained in:
DD 2017-09-05 16:51:03 -04:00
parent 5606b067e5
commit 29540e705e

View file

@ -380,15 +380,12 @@ class VirtualMachine extends EventEmitter {
* @param {int} costumeIndex - the index of the costume to be updated. * @param {int} costumeIndex - the index of the costume to be updated.
* @param {string} svg - new SVG for the renderer. * @param {string} svg - new SVG for the renderer.
*/ */
updateSvg (costumeIndex, svg) { updateSvg (costumeIndex, svg, rotationCenterX, rotationCenterY) {
const costume = this.editingTarget.sprite.costumes[costumeIndex]; const costume = this.editingTarget.sprite.costumes[costumeIndex];
costume.rotationCenterX = rotationCenterX;
costume.rotationCenterY = rotationCenterY;
if (costume && this.runtime && this.runtime.renderer) { if (costume && this.runtime && this.runtime.renderer) {
const rotationCenter = [ this.runtime.renderer.updateSVGSkin(costume.skinId, svg, [rotationCenterX, rotationCenterY]);
costume.rotationCenterX / costume.bitmapResolution,
costume.rotationCenterY / costume.bitmapResolution
];
this.runtime.renderer.updateSVGSkin(costume.skinId, svg, rotationCenter);
} }
// @todo: Also update storage in addition to renderer. Without storage, if you switch // @todo: Also update storage in addition to renderer. Without storage, if you switch
// costumes and switch back, you will lose your changes in the paint editor. // costumes and switch back, you will lose your changes in the paint editor.