mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-07 19:14:40 -04:00
Fix handling of stack click
Previously was improperly reading `e.type`.
This commit is contained in:
parent
1ab391281d
commit
9ce3783940
3 changed files with 17 additions and 11 deletions
11
src/index.js
11
src/index.js
|
@ -28,7 +28,13 @@ function VirtualMachine () {
|
||||||
if (typeof e !== 'object') return;
|
if (typeof e !== 'object') return;
|
||||||
if (typeof e.blockId !== 'string') return;
|
if (typeof e.blockId !== 'string') return;
|
||||||
|
|
||||||
// Blocks
|
// UI event: clicked stacks toggle in the runtime.
|
||||||
|
if (e.element === 'stackclick') {
|
||||||
|
instance.runtime.toggleStack(e.blockId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Block create/update/destroy
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case 'create':
|
case 'create':
|
||||||
instance.runtime.createBlock(adapter(e), false);
|
instance.runtime.createBlock(adapter(e), false);
|
||||||
|
@ -55,9 +61,6 @@ function VirtualMachine () {
|
||||||
id: e.blockId
|
id: e.blockId
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'stackclick':
|
|
||||||
instance.runtime.toggleStack(e.blockId);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
11
vm.js
11
vm.js
|
@ -74,7 +74,13 @@
|
||||||
if (typeof e !== 'object') return;
|
if (typeof e !== 'object') return;
|
||||||
if (typeof e.blockId !== 'string') return;
|
if (typeof e.blockId !== 'string') return;
|
||||||
|
|
||||||
// Blocks
|
// UI event: clicked stacks toggle in the runtime.
|
||||||
|
if (e.element === 'stackclick') {
|
||||||
|
instance.runtime.toggleStack(e.blockId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Block create/update/destroy
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case 'create':
|
case 'create':
|
||||||
instance.runtime.createBlock(adapter(e), false);
|
instance.runtime.createBlock(adapter(e), false);
|
||||||
|
@ -101,9 +107,6 @@
|
||||||
id: e.blockId
|
id: e.blockId
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'stackclick':
|
|
||||||
instance.runtime.toggleStack(e.blockId);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
6
vm.min.js
vendored
6
vm.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue