From 29540e705e2a42674fd2d8a6be080e3115c820c5 Mon Sep 17 00:00:00 2001 From: DD Date: Tue, 5 Sep 2017 16:51:03 -0400 Subject: [PATCH] Add updating the rotation center to updateSvg --- src/virtual-machine.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 61afda386..04409b3b0 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -380,15 +380,12 @@ class VirtualMachine extends EventEmitter { * @param {int} costumeIndex - the index of the costume to be updated. * @param {string} svg - new SVG for the renderer. */ - updateSvg (costumeIndex, svg) { + updateSvg (costumeIndex, svg, rotationCenterX, rotationCenterY) { const costume = this.editingTarget.sprite.costumes[costumeIndex]; + costume.rotationCenterX = rotationCenterX; + costume.rotationCenterY = rotationCenterY; if (costume && this.runtime && this.runtime.renderer) { - const rotationCenter = [ - costume.rotationCenterX / costume.bitmapResolution, - costume.rotationCenterY / costume.bitmapResolution - ]; - - this.runtime.renderer.updateSVGSkin(costume.skinId, svg, rotationCenter); + this.runtime.renderer.updateSVGSkin(costume.skinId, svg, [rotationCenterX, rotationCenterY]); } // @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.