rename stage monitors along with stage

Rename Stage object and monitors together then use the set name to name
the sprite.
This commit is contained in:
Michael "Z" Goddard 2018-09-07 14:36:44 -04:00
parent b41423bdfa
commit db7b356825
No known key found for this signature in database
GPG key ID: 762CD40DD5349872

View file

@ -355,7 +355,16 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip)
const sprite = new Sprite(blocks, runtime); const sprite = new Sprite(blocks, runtime);
// Sprite/stage name from JSON. // Sprite/stage name from JSON.
if (object.hasOwnProperty('objName')) { if (object.hasOwnProperty('objName')) {
sprite.name = topLevel ? 'Stage' : object.objName; if (topLevel && object.objName !== 'Stage') {
for (const child of object.children) {
if (!child.hasOwnProperty('objName') && child.target === object.objName) {
child.target = 'Stage';
}
}
object.objName = 'Stage';
}
sprite.name = object.objName;
} }
// Costumes from JSON. // Costumes from JSON.
const costumePromises = []; const costumePromises = [];