Fix CanvasFrame loadFromURL

This commit is contained in:
JannisX11 2020-10-15 15:55:19 +02:00
parent 71bd189903
commit c3e3c7eb4a

View File

@ -30,15 +30,13 @@ class CanvasFrame {
this.canvas.height = h;
this.ctx = this.canvas.getContext('2d')
}
replace(layer) {
this.canvas
}
async loadFromURL(url) {
let img = new Image()
img.src = url;
await new Promise((resolve, reject) => {
img.onload = function() {
resolve()
img.onload = () => {
this.loadFromImage(img);
resolve();
}
img.onerror = reject;
})