get rid of the grey areas

Let the worldmorph rerender the stage if it found the stage need to be updated.
pull/101/head
Simon-Mong 2021-09-08 12:44:56 +08:00 zatwierdzone przez GitHub
rodzic 3058111f9a
commit dea52c2976
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 29 dodań i 0 usunięć

Wyświetl plik

@ -280,3 +280,32 @@ HueWheelMorph.prototype.render = function (context) {
}
}
};
WorldMorph.prototype.updateBroken = function () {
var ctx = this.worldCanvas.getContext('2d'),
i,ide,stage,bounds;
for (i = 0; i < this.children.length; i += 1) {
if (this.children[i] instanceof IDE_Morph) {
ide = this.children[i];
stage = ide.stage;
bounds = stage.bounds;
}
}
this.condenseDamages();
this.broken.forEach(rect => {
if (rect.extent().gt(ZERO)) {
this.fullDrawOn(ctx, rect);
}
});
if (ide) {
if ( this.broken.some(area => area.intersect(bounds).area() > 0)) {
stage.reRender();
}
}
this.broken = [];
};