mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-11 10:39:56 -05:00
Fix some issues: 1. Monitors not running anymore if you change categories 2. Visual reports not showing 3. threads acquiring properties of old thread when restarting thread
This commit is contained in:
parent
6b774c58f5
commit
2a7f3edda6
2 changed files with 11 additions and 4 deletions
|
@ -30,7 +30,12 @@ const execute = function (sequencer, thread) {
|
|||
const currentBlockId = thread.peekStack();
|
||||
const currentStackFrame = thread.peekStackFrame();
|
||||
|
||||
let blockContainer = target.blocks;
|
||||
let blockContainer;
|
||||
if (thread.updateMonitor) {
|
||||
blockContainer = runtime.monitorBlocks;
|
||||
} else {
|
||||
blockContainer = target.blocks;
|
||||
}
|
||||
let block = blockContainer.getBlock(currentBlockId);
|
||||
if (typeof block === 'undefined') {
|
||||
blockContainer = runtime.flyoutBlocks;
|
||||
|
|
|
@ -399,8 +399,8 @@ class Runtime extends EventEmitter {
|
|||
* @param {!string} id ID of block that starts the stack.
|
||||
* @param {!Target} target Target to run thread on.
|
||||
* @param {?object} opts optional arguments
|
||||
* @param {?boolean} opts.optShowVisualReport true if the script should show speech bubble for its value
|
||||
* @param {?boolean} opts.optUpdateMonitor true if the script should show and update a monitor with its value
|
||||
* @param {?boolean} opts.showVisualReport true if the script should show speech bubble for its value
|
||||
* @param {?boolean} opts.updateMonitor true if the script should show and update a monitor with its value
|
||||
* @return {!Thread} The newly created thread.
|
||||
*/
|
||||
_pushThread (id, target, opts) {
|
||||
|
@ -411,7 +411,7 @@ class Runtime extends EventEmitter {
|
|||
|
||||
const thread = new Thread(id);
|
||||
thread.target = target;
|
||||
thread.showVisualReport = opts.optShowVisualReport;
|
||||
thread.showVisualReport = opts.showVisualReport;
|
||||
thread.updateMonitor = opts.updateMonitor;
|
||||
|
||||
thread.pushStack(id);
|
||||
|
@ -442,6 +442,8 @@ class Runtime extends EventEmitter {
|
|||
_restartThread (thread) {
|
||||
const newThread = new Thread(thread.topBlock);
|
||||
newThread.target = thread.target;
|
||||
newThread.showVisualReport = thread.showVisualReport;
|
||||
newThread.updateMonitor = thread.updateMonitor;
|
||||
newThread.pushStack(thread.topBlock);
|
||||
const i = this.threads.indexOf(thread);
|
||||
if (i > -1) {
|
||||
|
|
Loading…
Reference in a new issue