mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-01-18 15:26:19 +08:00
Fix CanvasFrame loadFromURL
This commit is contained in:
parent
71bd189903
commit
c3e3c7eb4a
@ -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;
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user