mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-12 07:45:41 -05:00
Merge pull request #379 from rschamp/bugfix/empty-rotation-center
Only update costume rotationCenter if it exists
This commit is contained in:
commit
c6c4c4c00c
1 changed files with 14 additions and 11 deletions
|
@ -329,18 +329,21 @@ RenderedTarget.prototype.setCostume = function (index) {
|
||||||
);
|
);
|
||||||
if (this.renderer) {
|
if (this.renderer) {
|
||||||
var costume = this.sprite.costumes[this.currentCostume];
|
var costume = this.sprite.costumes[this.currentCostume];
|
||||||
var rotationCenter = costume.bitmapResolution ? [
|
var drawableProperties = {
|
||||||
costume.rotationCenterX / costume.bitmapResolution,
|
|
||||||
costume.rotationCenterY / costume.bitmapResolution
|
|
||||||
] : [
|
|
||||||
costume.rotationCenterX,
|
|
||||||
costume.rotationCenterY
|
|
||||||
];
|
|
||||||
this.renderer.updateDrawableProperties(this.drawableID, {
|
|
||||||
skin: costume.skin,
|
skin: costume.skin,
|
||||||
costumeResolution: costume.bitmapResolution,
|
costumeResolution: costume.bitmapResolution
|
||||||
rotationCenter: rotationCenter
|
};
|
||||||
});
|
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) {
|
if (this.visible) {
|
||||||
this.runtime.requestRedraw();
|
this.runtime.requestRedraw();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue