From d821a295046a14e953976b9f8f5a30532ed63b15 Mon Sep 17 00:00:00 2001 From: ck <21735205+cyperdark@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:21:37 +0300 Subject: [PATCH] fix: graph length for dt/ht --- .../tosu/src/entities/BeatmapPpData/index.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/tosu/src/entities/BeatmapPpData/index.ts b/packages/tosu/src/entities/BeatmapPpData/index.ts index 73a7e6e8..69a5576e 100644 --- a/packages/tosu/src/entities/BeatmapPpData/index.ts +++ b/packages/tosu/src/entities/BeatmapPpData/index.ts @@ -228,9 +228,11 @@ export class BeatmapPPData extends AbstractEntity { let oldStrains: number[] = []; const offset: number = strains.sectionLength; + const firstObj = this.timings.firstObj / mapAttributes.clockRate; + const lastObj = this.timings.full / mapAttributes.clockRate; + const mp3Length = menuData.MP3Length / mapAttributes.clockRate; let lazerBeatmap: ParsedBeatmap; - try { const decoder = new BeatmapDecoder(); @@ -268,11 +270,9 @@ export class BeatmapPPData extends AbstractEntity { ).toFixed(2)}ms on parsing beatmap` ); - const LEFT_OFFSET = Math.floor(this.timings.firstObj / offset); + const LEFT_OFFSET = Math.floor(firstObj / offset); const RIGHT_OFFSET = - menuData.MP3Length > this.timings.full - ? Math.ceil((menuData.MP3Length - this.timings.full) / offset) - : 0; + mp3Length > lastObj ? Math.ceil((mp3Length - lastObj) / offset) : 0; const updateWithOffset = (name: string, values: number[]) => { let data: number[] = []; @@ -335,13 +335,13 @@ export class BeatmapPPData extends AbstractEntity { resultStrains.xaxis.push(i * offset); } - const amount = Math.ceil(this.timings.full / offset); + const amount = Math.ceil(lastObj / offset); for (let i = 0; i < amount; i++) { - resultStrains.xaxis.push(this.timings.firstObj + i * offset); + resultStrains.xaxis.push(firstObj + i * offset); } for (let i = 0; i < RIGHT_OFFSET; i++) { - resultStrains.xaxis.push(this.timings.full + i * offset); + resultStrains.xaxis.push(lastObj + i * offset); } const end_time = performance.now();