@wemap/providers 11.0.0-alpha.15 → 11.0.0-alpha.17

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/dist/index.js CHANGED
@@ -1313,6 +1313,25 @@ const _StepProvider = class extends Provider {
1313
1313
  __publicField(this, "_algorithm", _StepProvider.DEFAULT_ALGORITHM);
1314
1314
  __publicField(this, "_accValues", []);
1315
1315
  __publicField(this, "getName", () => "StepDetector");
1316
+ __publicField(this, "onAccelerometerEvent", (accelerationEvent) => {
1317
+ if (!this.attitudeEvent || !this.angularRateEvent) {
1318
+ return;
1319
+ }
1320
+ const {
1321
+ values: acceleration,
1322
+ timestamp
1323
+ } = accelerationEvent;
1324
+ const linearAcc = _StepProvider.computeLinearAcceleration(
1325
+ this.attitudeEvent.quaternion,
1326
+ acceleration
1327
+ );
1328
+ const stepDetected = this.stepDetector.compute(timestamp, linearAcc, this.angularRateEvent.values);
1329
+ if (stepDetected) {
1330
+ const size = this.stepDetector.lastStepSize * this._stepSizeMultiplier;
1331
+ this.numOfSteps++;
1332
+ this.notify({ size, number: this.numOfSteps });
1333
+ }
1334
+ });
1316
1335
  this.algorithm = this._algorithm;
1317
1336
  }
1318
1337
  availability() {
@@ -1342,25 +1361,6 @@ const _StepProvider = class extends Provider {
1342
1361
  GyroscopeProvider$1.removeEventListener(this.gyroscopeProviderId);
1343
1362
  RelativeAttitudeFromInertialProvider.removeEventListener(this.attitudeProviderId);
1344
1363
  }
1345
- onAccelerometerEvent(accelerationEvent) {
1346
- if (!this.attitudeEvent || !this.angularRateEvent) {
1347
- return;
1348
- }
1349
- const {
1350
- values: acceleration,
1351
- timestamp
1352
- } = accelerationEvent;
1353
- const linearAcc = _StepProvider.computeLinearAcceleration(
1354
- this.attitudeEvent.quaternion,
1355
- acceleration
1356
- );
1357
- const stepDetected = this.stepDetector.compute(timestamp, linearAcc, this.angularRateEvent.values);
1358
- if (stepDetected) {
1359
- const size = this.stepDetector.lastStepSize * this._stepSizeMultiplier;
1360
- this.numOfSteps++;
1361
- this.notify({ size, number: this.numOfSteps });
1362
- }
1363
- }
1364
1364
  static computeLinearAcceleration(quaternion, acc) {
1365
1365
  const linearAcc = maths.Quaternion.rotateMatlab(maths.Quaternion.inverse(quaternion), acc);
1366
1366
  linearAcc[2] -= geo.Constants.EARTH_GRAVITY;
@@ -2010,7 +2010,9 @@ const _AbsolutePositionProvider = class extends Provider {
2010
2010
  start() {
2011
2011
  GeoRelativePositionProvider$1.getAvailability().then((error) => {
2012
2012
  if (!error) {
2013
- this._relativePositionProviderId = GeoRelativePositionProvider$1.addEventListener(this._onRelativePosition);
2013
+ this._relativePositionProviderId = GeoRelativePositionProvider$1.addEventListener(
2014
+ (e) => this._onRelativePosition(e)
2015
+ );
2014
2016
  }
2015
2017
  });
2016
2018
  this._gnssWifiProviderId = GnssWifiProvider$1.addEventListener(