Skip to content

Commit

Permalink
fix(landing): Fix the map switcher that setting bearing and pitch to 0.
Browse files Browse the repository at this point in the history
BM-1063 (#3326)

### Motivation
Landing page map switcher on the bottom left doesn't set the map
location when bearing or pitch is 0.

### Modifications
The map switcher sets the bearing and pitch by the update location from
config. But it is skip setting when pitch or bearing is null. We should
also set to 0 if null.

### Verification

---------

Co-authored-by: Blayne Chard <bchard@linz.govt.nz>
  • Loading branch information
Wentao-Kuang and blacha authored Aug 14, 2024
1 parent c25486c commit 47304ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/landing/src/components/map.switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export class MapSwitcher extends Component {

this.map.setZoom(Math.max(location.zoom - 4, 0));
this.map.setCenter([location.lon, location.lat]);
if (Config.map.location.bearing != null) this.map.setBearing(Config.map.location.bearing);
if (Config.map.location.pitch != null) this.map.setPitch(Config.map.location.pitch);
this.map.setBearing(Config.map.location.bearing ?? 0);
this.map.setPitch(Config.map.location.pitch ?? 0);
this.forceUpdate();
};

Expand Down

0 comments on commit 47304ff

Please sign in to comment.