mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-28 22:30:40 -04:00
Update specmap and sb2 import to add new fields to layering blocks.
This commit is contained in:
parent
fe51bd6450
commit
477ef531ba
3 changed files with 21 additions and 3 deletions
|
@ -601,6 +601,20 @@ const parseBlock = function (sb2block, addBroadcastMsg, getVariableId, extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Updated layering blocks
|
||||||
|
if (oldOpcode === 'comeToFront') {
|
||||||
|
activeBlock.fields.FRONT_BACK = {
|
||||||
|
name: 'FRONT_BACK',
|
||||||
|
value: 'front'
|
||||||
|
};
|
||||||
|
} else if (oldOpcode === 'goBackByLayers:') {
|
||||||
|
activeBlock.fields.FORWARD_BACKWARD = {
|
||||||
|
name: 'FORWARD_BACKWARD',
|
||||||
|
value: 'backward'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Special cases to generate mutations.
|
// Special cases to generate mutations.
|
||||||
if (oldOpcode === 'stopScripts') {
|
if (oldOpcode === 'stopScripts') {
|
||||||
// Mutation for stop block: if the argument is 'other scripts',
|
// Mutation for stop block: if the argument is 'other scripts',
|
||||||
|
|
|
@ -345,12 +345,12 @@ const specMap = {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'comeToFront': {
|
'comeToFront': {
|
||||||
opcode: 'looks_gotofront',
|
opcode: 'looks_gotofrontback',
|
||||||
argMap: [
|
argMap: [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'goBackByLayers:': {
|
'goBackByLayers:': {
|
||||||
opcode: 'looks_gobacklayers',
|
opcode: 'looks_goforwardbackwardlayers',
|
||||||
argMap: [
|
argMap: [
|
||||||
{
|
{
|
||||||
type: 'input',
|
type: 'input',
|
||||||
|
|
|
@ -293,8 +293,12 @@ test('layers', t => {
|
||||||
a.renderer = renderer;
|
a.renderer = renderer;
|
||||||
a.goToFront();
|
a.goToFront();
|
||||||
t.equals(a.renderer.order, 5);
|
t.equals(a.renderer.order, 5);
|
||||||
a.goBackLayers(2);
|
a.goBackwardLayers(2);
|
||||||
t.equals(a.renderer.order, 3);
|
t.equals(a.renderer.order, 3);
|
||||||
|
a.goToBack();
|
||||||
|
t.equals(a.renderer.order, 1);
|
||||||
|
a.goForwardLayers(1);
|
||||||
|
t.equals(a.renderer.order, 2);
|
||||||
o.drawableID = 999;
|
o.drawableID = 999;
|
||||||
a.goBehindOther(o);
|
a.goBehindOther(o);
|
||||||
t.equals(a.renderer.order, 1);
|
t.equals(a.renderer.order, 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue