mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-10 21:14:06 -04:00
cope with async renderer.createSVGSkin
This commit is contained in:
parent
2d721c4c74
commit
b8b3de967d
1 changed files with 13 additions and 12 deletions
|
@ -21,21 +21,22 @@ const loadVector_ = function (costume, runtime, rotationCenter, optVersion) {
|
|||
log.error('No V2 SVG adapter present; SVGs may not render correctly.');
|
||||
}
|
||||
resolve(svgString); // unmodified
|
||||
}).then(svgString => {
|
||||
}).then(svgString => new Promise(resolve => {
|
||||
// createSVGSkin does the right thing if rotationCenter isn't provided, so it's okay if it's
|
||||
// undefined here
|
||||
costume.skinId = runtime.renderer.createSVGSkin(svgString, rotationCenter);
|
||||
costume.size = runtime.renderer.getSkinSize(costume.skinId);
|
||||
// Now we should have a rotationCenter even if we didn't before
|
||||
if (!rotationCenter) {
|
||||
rotationCenter = runtime.renderer.getSkinRotationCenter(costume.skinId);
|
||||
costume.rotationCenterX = rotationCenter[0];
|
||||
costume.rotationCenterY = rotationCenter[1];
|
||||
costume.bitmapResolution = 1;
|
||||
}
|
||||
costume.skinId = runtime.renderer.createSVGSkin(svgString, rotationCenter, () => {
|
||||
costume.size = runtime.renderer.getSkinSize(costume.skinId);
|
||||
// Now we should have a rotationCenter even if we didn't before
|
||||
if (!rotationCenter) {
|
||||
rotationCenter = runtime.renderer.getSkinRotationCenter(costume.skinId);
|
||||
costume.rotationCenterX = rotationCenter[0];
|
||||
costume.rotationCenterY = rotationCenter[1];
|
||||
costume.bitmapResolution = 1;
|
||||
}
|
||||
|
||||
return costume;
|
||||
});
|
||||
resolve(costume);
|
||||
});
|
||||
}));
|
||||
};
|
||||
|
||||
const canvasPool = (function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue