diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index 546f594df..e173ca04d 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -244,9 +244,8 @@ class Scratch3LooksBlocks { getMonitored () { return { looks_size: {isSpriteSpecific: true}, - looks_costumeorder: {isSpriteSpecific: true}, - looks_backdroporder: {}, - looks_backdropname: {} + looks_costumenumbername: {isSpriteSpecific: true}, + looks_backdropnumbername: {} }; } diff --git a/src/blocks/scratch3_sensing.js b/src/blocks/scratch3_sensing.js index 4f977a612..0cd4dde6d 100644 --- a/src/blocks/scratch3_sensing.js +++ b/src/blocks/scratch3_sensing.js @@ -56,7 +56,6 @@ class Scratch3SensingBlocks { sensing_answer: {}, sensing_loudness: {}, sensing_timer: {}, - sensing_of: {}, sensing_current: {} }; } diff --git a/src/engine/blocks.js b/src/engine/blocks.js index 920128dc6..b889f2010 100644 --- a/src/engine/blocks.js +++ b/src/engine/blocks.js @@ -3,6 +3,7 @@ const mutationAdapter = require('./mutation-adapter'); const xmlEscape = require('../util/xml-escape'); const MonitorRecord = require('./monitor-record'); const Clone = require('../util/clone'); +const {Map} = require('immutable'); /** * @fileoverview @@ -382,22 +383,38 @@ class Blocks { block.fields[args.name].id = args.value; } } else { + // Changing the value in a dropdown block.fields[args.name].value = args.value; + + if (!optRuntime){ + break; + } + + const flyoutBlock = block.shadow && block.parent ? this._blocks[block.parent] : block; + if (flyoutBlock.isMonitored) { + optRuntime.requestUpdateMonitor(Map({ + id: flyoutBlock.id, + params: this._getBlockParams(flyoutBlock) + })); + } } break; case 'mutation': block.mutation = mutationAdapter(args.value); break; - case 'checkbox': + case 'checkbox': { block.isMonitored = args.value; - if (optRuntime) { - const isSpriteSpecific = optRuntime.monitorBlockInfo.hasOwnProperty(block.opcode) && - optRuntime.monitorBlockInfo[block.opcode].isSpriteSpecific; - block.targetId = isSpriteSpecific ? optRuntime.getEditingTarget().id : null; + if (!optRuntime) { + break; } - if (optRuntime && wasMonitored && !block.isMonitored) { + + const isSpriteSpecific = optRuntime.monitorBlockInfo.hasOwnProperty(block.opcode) && + optRuntime.monitorBlockInfo[block.opcode].isSpriteSpecific; + block.targetId = isSpriteSpecific ? optRuntime.getEditingTarget().id : null; + + if (wasMonitored && !block.isMonitored) { optRuntime.requestRemoveMonitor(block.id); - } else if (optRuntime && !wasMonitored && block.isMonitored) { + } else if (!wasMonitored && block.isMonitored) { optRuntime.requestAddMonitor(MonitorRecord({ // @todo(vm#564) this will collide if multiple sprites use same block id: block.id, @@ -411,6 +428,7 @@ class Blocks { } break; } + } this.resetCache(); }