@wemap/providers 4.0.6 → 4.0.9
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 +2 -2
- package/src/providers/attitude/TurnDectector.js +14 -0
- package/src/providers/attitude/absolute/AbsoluteAttitude.js +1 -1
- package/src/providers/attitude/relative/RelativeAttitudeFromInertial.js +6 -2
- package/src/providers/imu/HighRotationsDetector.js +15 -0
- package/src/providers/position/absolute/AbsolutePosition.js +8 -2
package/package.json
CHANGED
|
@@ -24,6 +24,20 @@ class TurnDetector extends Provider {
|
|
|
24
24
|
return 'TurnDetector';
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @override
|
|
29
|
+
*/
|
|
30
|
+
static get eventsType() {
|
|
31
|
+
return [EventType.Turn];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @override
|
|
36
|
+
*/
|
|
37
|
+
get _availability() {
|
|
38
|
+
return RelativeAttitude.availability;
|
|
39
|
+
}
|
|
40
|
+
|
|
27
41
|
/**
|
|
28
42
|
* @override
|
|
29
43
|
*/
|
|
@@ -38,7 +38,8 @@ class RelativeAttitudeFromInertial extends Provider {
|
|
|
38
38
|
get _availability() {
|
|
39
39
|
return PromiseUtils.any([
|
|
40
40
|
RelativeAttitudeFromEkf.availability,
|
|
41
|
-
RelativeAttitudeFromBrowser.availability
|
|
41
|
+
RelativeAttitudeFromBrowser.availability,
|
|
42
|
+
HighRotationsDetector.availability
|
|
42
43
|
]);
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -55,7 +56,10 @@ class RelativeAttitudeFromInertial extends Provider {
|
|
|
55
56
|
events => this._parseEvent(events[0]),
|
|
56
57
|
error => this.notifyError(error)
|
|
57
58
|
);
|
|
58
|
-
this._highRotationsDetector = HighRotationsDetector.addEventListener(
|
|
59
|
+
this._highRotationsDetector = HighRotationsDetector.addEventListener(
|
|
60
|
+
() => {},
|
|
61
|
+
error => this.notifyError(error)
|
|
62
|
+
);
|
|
59
63
|
});
|
|
60
64
|
}
|
|
61
65
|
|
|
@@ -19,6 +19,21 @@ class HighRotationsDetector extends Provider {
|
|
|
19
19
|
return 'HighRotationsDetector';
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @override
|
|
25
|
+
*/
|
|
26
|
+
static get eventsType() {
|
|
27
|
+
return [EventType.HighRotation];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @override
|
|
32
|
+
*/
|
|
33
|
+
get _availability() {
|
|
34
|
+
return Gyroscope.availability;
|
|
35
|
+
}
|
|
36
|
+
|
|
22
37
|
/**
|
|
23
38
|
* @override
|
|
24
39
|
*/
|
|
@@ -100,8 +100,14 @@ class AbsolutePosition extends Provider {
|
|
|
100
100
|
|
|
101
101
|
if (lastPosition) {
|
|
102
102
|
|
|
103
|
-
//
|
|
104
|
-
|
|
103
|
+
// Is the new position accuracy is better enough than the last position accuracy
|
|
104
|
+
const isBetterEnough = newPosition.accuracy * AbsolutePosition.ACCURACY_RELOC_RATIO < lastPosition.accuracy;
|
|
105
|
+
|
|
106
|
+
// Is the new position is far from the new one (regarding accuracy)
|
|
107
|
+
// This is important if the person put the current page in the background during a while
|
|
108
|
+
const isFarEnough = lastPosition.distanceTo(newPosition) > lastPosition.accuracy + newPosition.accuracy;
|
|
109
|
+
|
|
110
|
+
if (!isBetterEnough && !isFarEnough) {
|
|
105
111
|
return;
|
|
106
112
|
}
|
|
107
113
|
|