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.
This commit is contained in:
Ray Schamp 2016-11-30 13:21:00 -05:00
parent ce17fdbd30
commit adaf2df743
2 changed files with 5 additions and 4 deletions

View file

@ -154,6 +154,7 @@ window.onload = function() {
}); });
vm.on('SPRITE_INFO_REPORT', function(data) { 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-x').value = data.x;
document.getElementById('sinfo-y').value = data.y; document.getElementById('sinfo-y').value = data.y;
document.getElementById('sinfo-direction').value = data.direction; document.getElementById('sinfo-direction').value = data.direction;

View file

@ -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. * @param {!Target} target Target to report sprite info for.
*/ */
Runtime.prototype.spriteInfoReport = function (target) { Runtime.prototype.spriteInfoReport = function (target) {
if (target !== this._editingTarget) { if (!target.isOriginal) return;
return;
}
this.emit(Runtime.SPRITE_INFO_REPORT, { this.emit(Runtime.SPRITE_INFO_REPORT, {
id: target.id,
x: target.x, x: target.x,
y: target.y, y: target.y,
direction: target.direction, direction: target.direction,