Skip to content

Commit

Permalink
Merge pull request #379 from rschamp/bugfix/empty-rotation-center
Browse files Browse the repository at this point in the history
Only update costume rotationCenter if it exists
  • Loading branch information
rschamp committed Jan 13, 2017
2 parents 9b04392 + a56346d commit c6c4c4c
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/sprites/rendered-target.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,18 +329,21 @@ 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, {
var drawableProperties = {
skin: costume.skin,
costumeResolution: costume.bitmapResolution,
rotationCenter: rotationCenter
});
costumeResolution: costume.bitmapResolution
};
if (
typeof costume.rotationCenterX !== 'undefined' &&
typeof costume.rotationCenterY !== 'undefined'
) {
var scale = costume.bitmapResolution || 1;
drawableProperties.rotationCenter = [
costume.rotationCenterX / scale,
costume.rotationCenterY / scale
];
}
this.renderer.updateDrawableProperties(this.drawableID, drawableProperties);
if (this.visible) {
this.runtime.requestRedraw();
}
Expand Down

0 comments on commit c6c4c4c

Please sign in to comment.