mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 22:42:27 -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)
|
||||
.then(targets => {
|
||||
if (optForceSprite && targets.length === 1) {
|
||||
const target = targets[0];
|
||||
target.fixUpVariableReferences();
|
||||
}
|
||||
return targets;
|
||||
})
|
||||
.then(targets => ({
|
||||
targets,
|
||||
extensions
|
||||
|
|
|
@ -937,13 +937,6 @@ const deserialize = function (json, runtime, zip, isSingleSprite) {
|
|||
((isSingleSprite ? [json] : json.targets) || []).map(target =>
|
||||
parseScratchObject(target, runtime, extensions, zip))
|
||||
)
|
||||
.then(targets => {
|
||||
if (isSingleSprite && targets.length === 1) {
|
||||
const target = targets[0];
|
||||
target.fixUpVariableReferences();
|
||||
}
|
||||
return targets;
|
||||
})
|
||||
.then(targets => ({
|
||||
targets,
|
||||
extensions
|
||||
|
|
|
@ -386,6 +386,10 @@ class VirtualMachine extends EventEmitter {
|
|||
this.editingTarget = targets[0];
|
||||
}
|
||||
|
||||
if (!wholeProject) {
|
||||
this.editingTarget.fixUpVariableReferences();
|
||||
}
|
||||
|
||||
// Update the VM user's knowledge of targets and blocks on the workspace.
|
||||
this.emitTargetsUpdate();
|
||||
this.emitWorkspaceUpdate();
|
||||
|
|
Loading…
Reference in a new issue