Use fractional values in cyclist

This commit is contained in:
Tijmen Zwaan
2026-10-16 11:15:50 +02:00
parent 1df7e03668
commit c33c845562
+4 -4
View File
@@ -78,12 +78,12 @@ export class Cyclist {
// Sort the haps based on their onset, so cps changes within the
// tick duration happen in the correct order.
.sort((a, b) => {
const aBegin = a.whole.begin.valueOf();
const bBegin = b.whole.begin.valueOf();
const aBegin = a.whole.begin;
const bBegin = b.whole.begin;
// If haps happen at the same time, trigger the haps that cause
// cps changes first, so the durations of the simultaneous haps
// are adjusted accordingly.
if (aBegin === bBegin) {
if (aBegin.eq(bBegin)) {
if (a.value.cps !== undefined) {
return b.value.cps !== undefined ? 0 : -1;
}
@@ -92,7 +92,7 @@ export class Cyclist {
}
return 0;
}
return aBegin - bBegin;
return aBegin.sub(bBegin);
});
haps.forEach((hap) => {