Skip to content

Commit

Permalink
fix(graphics): 0 being transformed into infinity through `numberToStr…
Browse files Browse the repository at this point in the history
…ing()`
  • Loading branch information
NriotHrreion committed Jun 6, 2024
1 parent d36a068 commit 95d8bca
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/renderer/Graphics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ export default class Graphics {
public static numberToString(n: number, fractionDigits?: number): string {
const abs = Math.abs(n);

if(abs === 0) return fractionDigits !== undefined ? (0).toFixed(fractionDigits) : "0";

if(abs < minSn && abs > maxSn) {
return fractionDigits !== undefined ? n.toFixed(fractionDigits) : n.toString();
}
Expand Down

1 comment on commit 95d8bca

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.