Skip to content

Commit

Permalink
change resizing checking
Browse files Browse the repository at this point in the history
  • Loading branch information
tillvit committed Dec 28, 2023
1 parent 2fdb3c2 commit 49e3ac7
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions app/src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export class App {
powerPreference: "low-power",
})

setTimeout(() => this.onResize(), 1000)
this.ticker = new Ticker()
this.ticker.maxFPS = 120
this.ticker.add(() => {
Expand Down Expand Up @@ -296,13 +295,13 @@ export class App {
})

setInterval(() => {
if (
this.lastHeight != window.innerHeight ||
this.lastWidth != window.innerWidth
) {
this.lastHeight = window.innerHeight
this.lastWidth = window.innerWidth
this.onResize()
const screenWidth = window.innerWidth
const screenHeight =
window.innerHeight - document.getElementById("menubar")!.clientHeight
if (this.lastHeight != screenHeight || this.lastWidth != screenWidth) {
this.lastHeight = screenHeight
this.lastWidth = screenWidth
this.onResize(screenWidth, screenHeight)
EventHandler.emit("resize")
}
}, 100)
Expand Down Expand Up @@ -356,10 +355,7 @@ export class App {
})
}

onResize() {
const screenWidth = window.innerWidth
const screenHeight =
window.innerHeight - document.getElementById("menubar")!.clientHeight
onResize(screenWidth: number, screenHeight: number) {
this.renderer.screen.width = screenWidth
this.renderer.screen.height = screenHeight
this.view.width = screenWidth * this.renderer.resolution
Expand Down

0 comments on commit 49e3ac7

Please sign in to comment.