diff --git a/HISTORY.md b/HISTORY.md index c1122792..2eac1b4a 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -72,6 +72,7 @@ ### 2021-12-09 * blocks, threads: never push untested last minute changes that might break everything * gui: select motion category when switching to a scene that doesn't have the current custom category +* objects: worked around an asynchronous rendering issue ### 2021-12-08 * blocks: refactored syntax trees diff --git a/snap.html b/snap.html index c09f5395..f8e9ce23 100755 --- a/snap.html +++ b/snap.html @@ -18,7 +18,7 @@ - + diff --git a/src/objects.js b/src/objects.js index 5867aa6d..c809e3d6 100644 --- a/src/objects.js +++ b/src/objects.js @@ -87,7 +87,7 @@ BlockVisibilityDialogMorph*/ /*jshint esversion: 6*/ -modules.objects = '2021-November-07'; +modules.objects = '2021-November-09'; var SpriteMorph; var StageMorph; @@ -8076,7 +8076,10 @@ StageMorph.prototype.render = function (ctx) { ctx.save(); ctx.fillStyle = this.color.toString(); ctx.fillRect(0, 0, this.width(), this.height()); - if (this.costume) { + if (this.costume && + this.costume.contents.width && + this.costume.contents.height + ) { ctx.scale(this.scale, this.scale); ctx.drawImage( this.costume.contents, @@ -8084,6 +8087,9 @@ StageMorph.prototype.render = function (ctx) { (this.height() / this.scale - this.costume.height()) / 2 ); this.cachedImage = this.applyGraphicsEffects(this.cachedImage); + } else { // deal with async asset creation + this.costume = null; + this.cachedImage = null; } ctx.restore(); this.version = Date.now(); // for observer optimization