@aibee/crc-bmap 0.6.13 → 0.6.15

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/lib/bmap.esm.js CHANGED
@@ -8385,6 +8385,7 @@ var PositionNavigation = class extends EventDispatcher10 {
8385
8385
  resetTimer = null;
8386
8386
  tweenUtil = new TweenUtil();
8387
8387
  simulationTween;
8388
+ throttleUpdatePosition;
8388
8389
  get curRoutePath() {
8389
8390
  return this.paths[this.routeIndex] || null;
8390
8391
  }
@@ -8501,6 +8502,10 @@ var PositionNavigation = class extends EventDispatcher10 {
8501
8502
  this.emitNavigationStatus();
8502
8503
  this.startCurRouteSimulation();
8503
8504
  }
8505
+ pause() {
8506
+ this.tweenUtil.pause();
8507
+ this.throttleUpdatePosition?.cancel();
8508
+ }
8504
8509
  async startCurRouteSimulation() {
8505
8510
  const { curRoutePath } = this;
8506
8511
  if (!curRoutePath) {
@@ -8514,7 +8519,7 @@ var PositionNavigation = class extends EventDispatcher10 {
8514
8519
  const path = [this.position, ...this.curRoutePathPoints.slice(this.pointIndex + 1)];
8515
8520
  const distance = this.getCurRouteRemainDistance();
8516
8521
  const time = distance / this.options.simulationSpeed;
8517
- const onUpdate = throttle((v) => {
8522
+ const onUpdate = this.throttleUpdatePosition = throttle((v) => {
8518
8523
  const pos = getPosByPathDistance(path, v.distance);
8519
8524
  if (!pos) {
8520
8525
  return;
@@ -8865,8 +8870,9 @@ var Navigation = class extends Plugin {
8865
8870
  }
8866
8871
  }
8867
8872
  pauseAnimation() {
8873
+ this.taskQueue.clear();
8874
+ this.positionNavigation.pause();
8868
8875
  this.tweenUtil.pause();
8869
- this.positionNavigation.tweenUtil.pause();
8870
8876
  }
8871
8877
  continueAnimation() {
8872
8878
  this.tweenUtil.continue();
@@ -9212,9 +9218,7 @@ var Navigation = class extends Plugin {
9212
9218
  }
9213
9219
  if (!this.options.disablePathAnimation) {
9214
9220
  tween?.pause();
9215
- this.positionNavigation.tweenUtil.pause();
9216
9221
  await this.changeCameraToPathUp(500 / this.options.speed);
9217
- this.positionNavigation.tweenUtil.continue();
9218
9222
  tween?.resume();
9219
9223
  }
9220
9224
  }