From 4ba76bbdbd0ee3e6c459919a4e823312949fb720 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Thu, 12 Jan 2017 15:34:05 -0500 Subject: [PATCH] Fix adding SVG costumes Previously it assumed every costume to have a `bitmapResolution` property which doesn't apply to vector costumes. This caused the renderer to not render added SVG costumes when they were added with setCostume. --- src/sprites/rendered-target.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/sprites/rendered-target.js b/src/sprites/rendered-target.js index b5b89365c..69177b9ac 100644 --- a/src/sprites/rendered-target.js +++ b/src/sprites/rendered-target.js @@ -329,13 +329,17 @@ RenderedTarget.prototype.setCostume = function (index) { ); if (this.renderer) { var costume = this.sprite.costumes[this.currentCostume]; + var rotationCenter = costume.bitmapResolution ? [ + costume.rotationCenterX / costume.bitmapResolution, + costume.rotationCenterY / costume.bitmapResolution + ] : [ + costume.rotationCenterX, + costume.rotationCenterY + ]; this.renderer.updateDrawableProperties(this.drawableID, { skin: costume.skin, costumeResolution: costume.bitmapResolution, - rotationCenter: [ - costume.rotationCenterX / costume.bitmapResolution, - costume.rotationCenterY / costume.bitmapResolution - ] + rotationCenter: rotationCenter }); if (this.visible) { this.runtime.requestRedraw();