mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-02 01:22:31 -04:00
fix: run stacks in response to click events (#1)
* fix: run stacks in response to stack click events * refactor: listen for regular click events to run block stacks
This commit is contained in:
parent
1e3b406bd4
commit
12e2362ac6
1 changed files with 6 additions and 6 deletions
|
@ -308,12 +308,6 @@ class Blocks {
|
||||||
const stage = this.runtime.getTargetForStage();
|
const stage = this.runtime.getTargetForStage();
|
||||||
const editingTarget = this.runtime.getEditingTarget();
|
const editingTarget = this.runtime.getEditingTarget();
|
||||||
|
|
||||||
// UI event: clicked scripts toggle in the runtime.
|
|
||||||
if (e.element === 'stackclick') {
|
|
||||||
this.runtime.toggleScript(e.blockId, {stackClick: true});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Block create/update/destroy
|
// Block create/update/destroy
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case 'create': {
|
case 'create': {
|
||||||
|
@ -503,6 +497,12 @@ class Blocks {
|
||||||
this.emitProjectChanged();
|
this.emitProjectChanged();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'click':
|
||||||
|
// UI event: clicked scripts toggle in the runtime.
|
||||||
|
if (e.targetType === 'block') {
|
||||||
|
this.runtime.toggleScript(this.getTopLevelScript(e.blockId), {stackClick: true});
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue