diff --git a/app/src/App.ts b/app/src/App.ts index ed2fb441..bfe04290 100644 --- a/app/src/App.ts +++ b/app/src/App.ts @@ -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(() => { @@ -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) @@ -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 diff --git a/app/src/chart/ChartManager.ts b/app/src/chart/ChartManager.ts index 936135dd..e470466c 100644 --- a/app/src/chart/ChartManager.ts +++ b/app/src/chart/ChartManager.ts @@ -1124,7 +1124,7 @@ export class ChartManager { beat: number ): PartialNotedataEntry { const newHoldEndBeat = clamp( - Math.round((beat - Options.chart.snap) * 48) / 48, + Math.round((beat - Math.max(1 / 48, Options.chart.snap)) * 48) / 48, hold.beat, hold.beat + hold.hold - 1 / 48 ) @@ -1468,14 +1468,15 @@ export class ChartManager { this.loadedSM.requiresSSC() || (await FileHandler.getFileHandle(sscPath)) ) { - await FileHandler.writeFile(smPath, this.loadedSM.serialize("ssc")).catch( - err => { - const message = err.message - if (!message.includes(errors.GONE[0])) { - error = message - } + await FileHandler.writeFile( + sscPath, + this.loadedSM.serialize("ssc") + ).catch(err => { + const message = err.message + if (!message.includes(errors.GONE[0])) { + error = message } - ) + }) } if (error == null) { if (this.loadedSM.usesChartTiming()) { diff --git a/app/src/chart/component/edit/Waveform.ts b/app/src/chart/component/edit/Waveform.ts index d02ac79a..dbff1dbf 100644 --- a/app/src/chart/component/edit/Waveform.ts +++ b/app/src/chart/component/edit/Waveform.ts @@ -82,6 +82,10 @@ export class Waveform extends Sprite implements ChartRendererComponent { this.filters = value ? [new FXAAFilter()] : [] } ) + this.trackVariable( + () => this.renderer.chartManager.app.renderer.screen.width, + () => this.resizeWaveform() + ) this.trackVariable( () => this.renderer.chartManager.app.renderer.screen.height, () => this.resizeWaveform()