Skip to content

Commit

Permalink
Merge pull request #89 from tillvit/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
tillvit authored Dec 28, 2023
2 parents 37a7a84 + 49e3ac7 commit 92886ec
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 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
17 changes: 9 additions & 8 deletions app/src/chart/ChartManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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()) {
Expand Down
4 changes: 4 additions & 0 deletions app/src/chart/component/edit/Waveform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 92886ec

Please sign in to comment.