From adaf2df743d2301306b89cf6ecd19a61c04d142f Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Wed, 30 Nov 2016 13:21:00 -0500 Subject: [PATCH] Emit sprite info report for all sprites This allows costume data to reach listeners even when the sprite isn't the editing target. Filter out non-editing target reports in the playground to match previous behavior. --- playground/playground.js | 1 + src/engine/runtime.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/playground/playground.js b/playground/playground.js index cd9f8dff0..75a9f518e 100644 --- a/playground/playground.js +++ b/playground/playground.js @@ -154,6 +154,7 @@ window.onload = function() { }); vm.on('SPRITE_INFO_REPORT', function(data) { + if (data.id !== selectedTarget.value) return; // Not the editingTarget document.getElementById('sinfo-x').value = data.x; document.getElementById('sinfo-y').value = data.y; document.getElementById('sinfo-direction').value = data.direction; diff --git a/src/engine/runtime.js b/src/engine/runtime.js index 912c2923c..0e772eb44 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -723,14 +723,14 @@ Runtime.prototype.visualReport = function (blockId, value) { }; /** - * Emit a sprite info report if the provided target is the editing target. + * Emit a sprite info report if the provided target is the original sprite * @param {!Target} target Target to report sprite info for. */ Runtime.prototype.spriteInfoReport = function (target) { - if (target !== this._editingTarget) { - return; - } + if (!target.isOriginal) return; + this.emit(Runtime.SPRITE_INFO_REPORT, { + id: target.id, x: target.x, y: target.y, direction: target.direction,