worked around an asynchronous rendering issue

snap7
jmoenig 2021-12-09 16:50:32 +01:00
rodzic ecbefe7e42
commit f0ee59815f
3 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -18,7 +18,7 @@
<script src="src/widgets.js?version=2021-17-09"></script>
<script src="src/blocks.js?version=2021-12-09"></script>
<script src="src/threads.js?version=2021-12-09"></script>
<script src="src/objects.js?version=2021-12-07"></script>
<script src="src/objects.js?version=2021-12-09"></script>
<script src="src/scenes.js?version=2021-11-24"></script>
<script src="src/gui.js?version=2021-12-09"></script>
<script src="src/paint.js?version=2021-07-05"></script>

Wyświetl plik

@ -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