fix stretched puzzle
This commit is contained in:
parent
38093f1799
commit
5204131361
1 changed files with 6 additions and 5 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue