Skip to content

Commit

Permalink
CB-11462: (all) Make sure Coordinates#heading follows the w3c specifi…
Browse files Browse the repository at this point in the history
…cation.

Heading (course) can have a negative value on iOS devices when the OS is not able to determine the current heading.
This is against the w3c specification. Which only allows null and a number value >= 0 and <= 360.

See the following links for further informations:

 * https://dev.w3.org/geo/api/spec-source.html#heading
 * https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocation_Class/#//apple_ref/occ/instp/CLLocation/course
  • Loading branch information
Malte Legenhausen authored and breautek committed Sep 15, 2023
1 parent 0b6c059 commit e4bd983
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion www/Coordinates.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const Coordinates = function (lat, lng, alt, acc, head, vel, altacc) {
/**
* The direction the device is moving at the position.
*/
this.heading = head !== undefined ? head : null;
this.heading = (typeof head === 'number' && head >= 0 && head <= 360 ? head : null);
/**
* The velocity with which the device is moving at the position.
*/
Expand Down

0 comments on commit e4bd983

Please sign in to comment.