mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -05:00
Call fixUpVariableReferences in installTargets, before emitting the workspace update.
This commit is contained in:
parent
889443fcef
commit
b75a779540
3 changed files with 4 additions and 14 deletions
|
@ -668,13 +668,6 @@ const sb2import = function (json, runtime, optForceSprite, zip) {
|
||||||
};
|
};
|
||||||
|
|
||||||
return parseScratchObject(json, runtime, extensions, !optForceSprite, zip)
|
return parseScratchObject(json, runtime, extensions, !optForceSprite, zip)
|
||||||
.then(targets => {
|
|
||||||
if (optForceSprite && targets.length === 1) {
|
|
||||||
const target = targets[0];
|
|
||||||
target.fixUpVariableReferences();
|
|
||||||
}
|
|
||||||
return targets;
|
|
||||||
})
|
|
||||||
.then(targets => ({
|
.then(targets => ({
|
||||||
targets,
|
targets,
|
||||||
extensions
|
extensions
|
||||||
|
|
|
@ -937,13 +937,6 @@ const deserialize = function (json, runtime, zip, isSingleSprite) {
|
||||||
((isSingleSprite ? [json] : json.targets) || []).map(target =>
|
((isSingleSprite ? [json] : json.targets) || []).map(target =>
|
||||||
parseScratchObject(target, runtime, extensions, zip))
|
parseScratchObject(target, runtime, extensions, zip))
|
||||||
)
|
)
|
||||||
.then(targets => {
|
|
||||||
if (isSingleSprite && targets.length === 1) {
|
|
||||||
const target = targets[0];
|
|
||||||
target.fixUpVariableReferences();
|
|
||||||
}
|
|
||||||
return targets;
|
|
||||||
})
|
|
||||||
.then(targets => ({
|
.then(targets => ({
|
||||||
targets,
|
targets,
|
||||||
extensions
|
extensions
|
||||||
|
|
|
@ -386,6 +386,10 @@ class VirtualMachine extends EventEmitter {
|
||||||
this.editingTarget = targets[0];
|
this.editingTarget = targets[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!wholeProject) {
|
||||||
|
this.editingTarget.fixUpVariableReferences();
|
||||||
|
}
|
||||||
|
|
||||||
// Update the VM user's knowledge of targets and blocks on the workspace.
|
// Update the VM user's knowledge of targets and blocks on the workspace.
|
||||||
this.emitTargetsUpdate();
|
this.emitTargetsUpdate();
|
||||||
this.emitWorkspaceUpdate();
|
this.emitWorkspaceUpdate();
|
||||||
|
|
Loading…
Reference in a new issue