mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 15:02:52 -05:00
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.
This commit is contained in:
parent
eef463b821
commit
4ba76bbdbd
1 changed files with 8 additions and 4 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue