Merge pull request from kchadha/stage-layering

Layer group ordering.
This commit is contained in:
kchadha 2018-05-25 09:10:05 -04:00 committed by GitHub
commit a85f641d25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 79 additions and 40 deletions
src/serialization

View file

@ -15,6 +15,7 @@ const StringUtil = require('../util/string-util');
const specMap = require('./sb2_specmap');
const Variable = require('../engine/variable');
const MonitorRecord = require('../engine/monitor-record');
const StageLayering = require('../engine/stage-layering');
const {loadCostume} = require('../import/load-costume.js');
const {loadSound} = require('../import/load-sound.js');
@ -400,7 +401,7 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip)
}
// Create the first clone, and load its run-state from JSON.
const target = sprite.createClone();
const target = sprite.createClone(topLevel ? StageLayering.BACKGROUND_LAYER : StageLayering.SPRITE_LAYER);
const getVariableId = generateVariableIdGetter(target.id, topLevel);

View file

@ -8,6 +8,7 @@ const vmPackage = require('../../package.json');
const Blocks = require('../engine/blocks');
const Sprite = require('../sprites/sprite');
const Variable = require('../engine/variable');
const StageLayering = require('../engine/stage-layering');
const log = require('../util/log');
const uid = require('../util/uid');
@ -779,7 +780,7 @@ const parseScratchObject = function (object, runtime, extensions, zip) {
// process has been completed.
});
// Create the first clone, and load its run-state from JSON.
const target = sprite.createClone();
const target = sprite.createClone(object.isStage ? StageLayering.BACKGROUND_LAYER : StageLayering.SPRITE_LAYER);
// Load target properties from JSON.
if (object.hasOwnProperty('tempo')) {
target.tempo = object.tempo;