@wemap/providers 6.1.3 → 6.1.5
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
|
@@ -8,6 +8,7 @@ import MapMatchingHandler from '../../../mapmatching/MapMatchingHandler.js';
|
|
|
8
8
|
import GnssWifi from './GnssWifi.js';
|
|
9
9
|
import { default as GeoRelativePositionProvider } from '../relative/GeoRelativePosition.js';
|
|
10
10
|
import ProvidersOptions from '../../../ProvidersOptions.js';
|
|
11
|
+
import ProviderState from '../../ProviderState.js';
|
|
11
12
|
import Vps from '../../vision/Vps.js';
|
|
12
13
|
|
|
13
14
|
class AbsolutePosition extends Provider {
|
|
@@ -126,7 +127,7 @@ class AbsolutePosition extends Provider {
|
|
|
126
127
|
if (lastPosition) {
|
|
127
128
|
|
|
128
129
|
// Is the new position accuracy is better enough than the last position accuracy
|
|
129
|
-
const isBetterEnough = newPosition.accuracy * AbsolutePosition.ACCURACY_RELOC_RATIO
|
|
130
|
+
const isBetterEnough = newPosition.accuracy * AbsolutePosition.ACCURACY_RELOC_RATIO <= lastPosition.accuracy;
|
|
130
131
|
|
|
131
132
|
// Is the new position is far from the new one (regarding accuracy)
|
|
132
133
|
// This is important if the person put the current page in the background during a while
|
|
@@ -212,15 +213,16 @@ class AbsolutePosition extends Provider {
|
|
|
212
213
|
/** @type {ProviderEvent<UserPosition>} */
|
|
213
214
|
let newPositionEvent;
|
|
214
215
|
|
|
215
|
-
if (eventType === EventType.ForceVps
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
216
|
+
if (eventType === EventType.ForceVps) {
|
|
217
|
+
if (!this._vpsProviderId && this.state === ProviderState.STARTED) {
|
|
218
|
+
this._waitUntilNextVpsPosition = true;
|
|
219
|
+
this._vpsProviderId = Vps.addEventListener(events => {
|
|
220
|
+
this._waitUntilNextVpsPosition = false;
|
|
221
|
+
this._onAbsolutePosition(events.find(event => event.dataType === EventType.AbsolutePosition));
|
|
222
|
+
Vps.removeEventListener(this._vpsProviderId);
|
|
223
|
+
this._vpsProviderId = null;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
224
226
|
|
|
225
227
|
return;
|
|
226
228
|
|