Skip to content

Commit

Permalink
fix(ramp): fix sort to be stable when time indexes are equal
Browse files Browse the repository at this point in the history
Fixes Issue #343
  • Loading branch information
odbol committed Apr 15, 2022
1 parent cfc8590 commit 053107b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/ramp/src/aramp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { compareNumAsc } from "@thi.ng/compare/numeric";
import { absDiff } from "@thi.ng/math/abs";
import { clamp } from "@thi.ng/math/interval";
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
import { comparator2 } from "@thi.ng/vectors/compare";
import type { IRamp, RampBounds } from "./api.js";

export abstract class ARamp implements IRamp {
Expand Down Expand Up @@ -75,7 +74,7 @@ export abstract class ARamp implements IRamp {
}

sort() {
this.stops.sort(comparator2(0, 1));
this.stops.sort((a, b) => a[0] - b[0]);
}

uniform() {
Expand Down

0 comments on commit 053107b

Please sign in to comment.