Skip to content

fix(widgets): preserve fractional scale bar distances - #1045

Draft
premsinghsodha7 wants to merge 2 commits into
googlemaps:mainfrom
premsinghsodha7:fix/scale-bar-distance-precision
Draft

premsinghsodha7 wants to merge 2 commits into
googlemaps:mainfrom
premsinghsodha7:fix/scale-bar-distance-precision

Conversation

@premsinghsodha7

@premsinghsodha7 premsinghsodha7 commented Oct 18, 2026 •

Copy link
Copy Markdown

Fixes #233.

ScaleBar truncates kilometre and mile labels to integers: 1,900 m is labelled 1 km, and 3,200 m is labelled 1 mi instead of about 1.99 miles. Preserve fractional values using the locale decimal separator and at most two decimal places. Whole metres and feet keep their existing formatting; exactly 1,000 m now uses 1 km. No new dependencies or public API changes.

Validation:

  • Four of five new JVM regression tests fail with the extracted original logic; all five pass with the fix.
  • Widget unit tests and module lint passed; widget lint XML contains no issues.
  • Demo app and instrumentation APK builds passed.
  • Two rendering tests passed on Pixel_9_Pro_API_35, Android 15/API 35, 480 dpi. They compose the actual ScaleBar with a controlled projection and assert 1.98 km and 1.23 mi are displayed on light and dark backgrounds. Both captured widget images were visually inspected.
  • Updated live-map tests for fractional labels and corrected their reference screen coordinates to use horizontal width. All three explicitly skipped with Maps API key not specified; live map tiles/projection integration remains unverified.
  • :maps-app:lintDebug, spotlessCheck, and git diff --check passed.

The device rendering tests use a mocked projection and need no API key. Production drawing and projection calculation are unchanged.

  • Existing issue discusses the bug (ScaleBar has up to 100% error #233).
  • Tests and module linter pass.
  • Code coverage report not run.
  • No public API documentation changes needed.

Created as a draft per repository guidance for review of the label-precision approach.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ScaleBar has up to 100% error

1 participant