|
@@ -2206,9 +2206,13 @@ export const normalizeFixedPoint = <T extends FixedPoint | null>(
|
|
): T extends null ? null : FixedPoint => {
|
|
): T extends null ? null : FixedPoint => {
|
|
// Do not allow a precise 0.5 for fixed point ratio
|
|
// Do not allow a precise 0.5 for fixed point ratio
|
|
// to avoid jumping arrow heading due to floating point imprecision
|
|
// to avoid jumping arrow heading due to floating point imprecision
|
|
- if (fixedPoint && (fixedPoint[0] === 0.5 || fixedPoint[1] === 0.5)) {
|
|
|
|
|
|
+ if (
|
|
|
|
+ fixedPoint &&
|
|
|
|
+ (Math.abs(fixedPoint[0] - 0.5) < 0.0001 ||
|
|
|
|
+ Math.abs(fixedPoint[1] - 0.5) < 0.0001)
|
|
|
|
+ ) {
|
|
return fixedPoint.map((ratio) =>
|
|
return fixedPoint.map((ratio) =>
|
|
- ratio === 0.5 ? 0.5001 : ratio,
|
|
|
|
|
|
+ Math.abs(ratio - 0.5) < 0.0001 ? 0.5001 : ratio,
|
|
) as T extends null ? null : FixedPoint;
|
|
) as T extends null ? null : FixedPoint;
|
|
}
|
|
}
|
|
return fixedPoint as any as T extends null ? null : FixedPoint;
|
|
return fixedPoint as any as T extends null ? null : FixedPoint;
|