Skip to content

Commit

Permalink
fix: graph length for dt/ht
Browse files Browse the repository at this point in the history
  • Loading branch information
cyperdark authored and KotRikD committed Feb 15, 2024
1 parent 57664c7 commit d821a29
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/tosu/src/entities/BeatmapPpData/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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[] = [];
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d821a29

Please sign in to comment.