fix stretched puzzle

This commit is contained in:
Zutatensuppe 2021-04-16 01:52:34 +02:00
parent 38093f1799
commit 5204131361

View file

@ -6,12 +6,13 @@ function createCanvas(width = 0, height = 0) {
} }
async function loadImageToBitmap(imagePath) { async function loadImageToBitmap(imagePath) {
return new Promise((resolve) => {
const img = new Image() const img = new Image()
await new Promise((resolve) => { img.onload = () => {
img.onload = resolve createImageBitmap(img).then(resolve)
}
img.src = imagePath img.src = imagePath
}); })
return await createImageBitmap(img, 0, 0, img.width, img.height)
} }
async function resizeBitmap (bitmap, width, height) { async function resizeBitmap (bitmap, width, height) {