feat(#3): apply prettier
This commit is contained in:
parent
80292d6cce
commit
a3a8cde707
8 changed files with 145 additions and 689 deletions
|
@ -19,13 +19,15 @@ export class CanvasResizer {
|
|||
|
||||
load() {
|
||||
return new Promise((resolve) => {
|
||||
["load", "resize"].map(item => window.addEventListener(item, () => {
|
||||
this._resize();
|
||||
if (item === "load") {
|
||||
resolve();
|
||||
}
|
||||
}));
|
||||
})
|
||||
["load", "resize"].map((item) =>
|
||||
window.addEventListener(item, () => {
|
||||
this._resize();
|
||||
if (item === "load") {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
_resize() {
|
||||
|
@ -33,9 +35,9 @@ export class CanvasResizer {
|
|||
let canvasHeight = Math.floor(canvasWidth / (this.width / this.height));
|
||||
if (canvasHeight >= window.innerHeight * this.percentage) {
|
||||
canvasHeight = Math.floor(window.innerHeight * this.percentage);
|
||||
canvasWidth = Math.floor(canvasHeight / (this.height / this.width))
|
||||
canvasWidth = Math.floor(canvasHeight / (this.height / this.width));
|
||||
}
|
||||
this.canvas.style.width = canvasWidth + 'px';
|
||||
this.canvas.style.height = canvasHeight + 'px';
|
||||
this.canvas.style.width = canvasWidth + "px";
|
||||
this.canvas.style.height = canvasHeight + "px";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export async function getLevel(name) {
|
||||
const level = await fetch("/resources/" + name + ".json")
|
||||
return await level.json()
|
||||
}
|
||||
const level = await fetch("/resources/" + name + ".json");
|
||||
return await level.json();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue