Merge pull request #1431 from Rohilalala/fix/b-street-bearing-north

fix(street-level): show a 359.6° bearing as 0°, not 360°
This commit is contained in:
Said Turksever authored and GitHub committed 2026-10-28 00:36:53 +00:00
commit 9448c49acd
4 files changed
+15 -1

No files matched your search

@@ -0,0 +1,3 @@
- Show a Street Level view facing 359.5° or more as 0°. The viewer caption
rounded the bearing without wrapping, so a view facing 359.6° read "360°"
(Aditya, @Rohilalala, #1431).
+2
View File
@@ -3906,6 +3906,8 @@ reports it (`keyAlternatives`), and the panel's KEY REQUIRED, its coverage
line and the layer row's tooltip say to light it. The line and the layer row's tooltip say to light it. The
viewer sits under the header with EXPAND, FIT/FILL and close above the viewer sits under the header with EXPAND, FIT/FILL and close above the
image. SINCE is a stepped slider whose readout names the cut-off date. image. SINCE is a stepped slider whose readout names the cut-off date.
The viewer caption's bearing wraps after rounding to whole degrees, so a view
facing 359.5° or more reads `0°` rather than `360°`.
MapillaryJS loads on the first photo. Opening one frames it with a single MapillaryJS loads on the first photo. Opening one frames it with a single
camera flight through the application's deferred navigation (`begin` / camera flight through the application's deferred navigation (`begin` /
+2 -1
View File
@@ -168,8 +168,9 @@ function presentViewer(state) {
const { street } = state; const { street } = state;
const right = []; const right = [];
if (street.isPano) right.push('360°'); if (street.isPano) right.push('360°');
// 359.5° and above rounds to north; modulo keeps it from printing 360°.
if (Number.isFinite(street.bearing)) if (Number.isFinite(street.bearing))
right.push(`${Math.round(street.bearing)}°`); right.push(`${Math.round(street.bearing) % 360}°`);
if (street.capturedAt) if (street.capturedAt)
right.push(formatDate(street.capturedAt, street.capturedAtPrecision)); right.push(formatDate(street.capturedAt, street.capturedAtPrecision));
const left = []; const left = [];
+8
View File
@@ -273,6 +273,14 @@ test('viewer caption reads "Image by" left, date right, and links to Mapillary',
assert.equal(view.viewer.open, true); assert.equal(view.viewer.open, true);
}); });
test('a bearing that rounds to north reads 0°, not 360°', () => {
const caption = (bearing) =>
presentStreetLevelPanel(snapshot({ street: { open: true, bearing } }))
.viewer.captionRight;
assert.equal(caption(359.4), '359°');
assert.equal(caption(359.6), '0°');
});
test('an image without a creator name leaves the left caption empty', () => { test('an image without a creator name leaves the left caption empty', () => {
const view = presentStreetLevelPanel( const view = presentStreetLevelPanel(
snapshot({ snapshot({