@wemap/positioning 2.4.6 → 2.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  "lint": "eslint --ext .js,.jsx --quiet src",
81
81
  "test": "mocha -r esm \"src/**/*.spec.js\""
82
82
  },
83
- "version": "2.4.6"
83
+ "version": "2.4.7"
84
84
  }
@@ -142,7 +142,7 @@ class PdrProvider extends MapMatchingProvider {
142
142
  if (position instanceof WGS84) {
143
143
  this.pdrPosition = WGS84UserPosition.fromWGS84(position);
144
144
  if (window && window.performance) {
145
- this.pdrPosition.time = window.performance / 1e3;
145
+ this.pdrPosition.time = window.performance.now() / 1e3;
146
146
  }
147
147
  } else {
148
148
  this.pdrPosition = position;
@@ -1,4 +1,4 @@
1
- /* eslint max-statements: ["error", 27]*/
1
+ /* eslint-disable max-statements */
2
2
  import { WGS84UserPosition } from '@wemap/geo';
3
3
 
4
4
  // Generated positions by second
@@ -17,13 +17,12 @@ class Smoother {
17
17
  /**
18
18
  * Calculate smoothed positions for the next milliseconds given a new position
19
19
  */
20
- generateNextPositions(_newPosition, flyby = false) {
20
+ generateNextPositions(newPosition, flyby = false) {
21
21
 
22
- if (!(_newPosition instanceof WGS84UserPosition)) {
22
+ if (!(newPosition instanceof WGS84UserPosition)) {
23
23
  throw new TypeError('newPosition is not instance of WGS84UserPosition');
24
24
  }
25
25
 
26
- const newPosition = _newPosition.clone();
27
26
  if (!newPosition.hasOwnProperty('time')) {
28
27
  throw new Error('newPosition does not have time property');
29
28
  }
@@ -57,10 +56,13 @@ class Smoother {
57
56
  i = Math.min(i, nSamples);
58
57
  const smoothedPosition = this.previousPosition.destinationPoint(distance * i / nSamples, azimuth);
59
58
  smoothedPosition.time = refTimestamp + (i - 1) / GEN_FREQUENCY;
59
+ smoothedPosition.bearing = newPosition.bearing;
60
60
  this.positionsQueue.push(smoothedPosition);
61
61
  i++;
62
62
  }
63
63
 
64
+ this.positionsQueue[this.positionsQueue.length - 1].level = newPosition.level;
65
+
64
66
  this.previousPosition = newPosition;
65
67
  }
66
68