tweaked asynchronous costume loading/rendering issue

snap7
jmoenig 2021-12-13 09:54:35 +01:00
rodzic 2707410616
commit c44539a7a9
3 zmienionych plików z 6 dodań i 9 usunięć

Wyświetl plik

@ -71,6 +71,9 @@
* Brazilian Portuguese, thank you, Cassiano D'Andrea!
* Catalan, thanks, Joan!
### 2021-12-13
* objects: tweaked asynchronous costume loading/rendering issue
### 2021-12-12
* threads: fixed #2932

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-12"></script>
<script src="src/objects.js?version=2021-12-11"></script>
<script src="src/objects.js?version=2021-12-13"></script>
<script src="src/scenes.js?version=2021-11-24"></script>
<script src="src/gui.js?version=2021-12-11"></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-December-11';
modules.objects = '2021-December-13';
var SpriteMorph;
var StageMorph;
@ -8076,10 +8076,7 @@ StageMorph.prototype.render = function (ctx) {
ctx.save();
ctx.fillStyle = this.color.toString();
ctx.fillRect(0, 0, this.width(), this.height());
if (this.costume &&
this.costume.contents.width &&
this.costume.contents.height
) {
if (this.costume && !(this.costume.loaded instanceof Function)) {
ctx.scale(this.scale, this.scale);
ctx.drawImage(
this.costume.contents,
@ -8087,9 +8084,6 @@ 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