Skip to content

Replace Number.toFixed on scale labels; prefer locale-aware formatting #3

Description

@veillette

Summary

Spawned from Code Review #1 (Math Libraries / i18n).

Two call sites use JavaScript’s Number.prototype.toFixed instead of toFixed / toFixedNumber from scenerystack/dot (or locale-aware formatting):

  1. src/common/view/VernierScaleNode.ts — main-scale label text: value.toFixed(placesFor(value))
  2. src/caliper/view/CaliperNode.tstrimmed() helper: value.toFixed(3) for engraved marks

Why it matters

  • CRC / scenerystack-numerics: never use native Number.toFixed (cross-browser rounding).
  • User-facing readings already go through readingProperties.ts + Intl so French/Spanish get 23,14. Abstract scale labels on the Principle / shared scale views still show . as the separator, so locale switching leaves the comb inconsistent with the readout.

Suggested fix

  • Use toFixed from scenerystack/dot at minimum.
  • For labels meant as UI (not engraved instrument realism), prefer Intl.NumberFormat / the same helpers as readingProperties.ts, keyed off localeProperty.
  • Caliper/micrometer engraved numerals may stay period-based for instrument fidelity — still switch off native toFixed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions