open-plant 1.4.20 → 1.4.21

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
@@ -7175,7 +7175,7 @@ class Uc {
7175
7175
  Qi(this.viewAnimationState);
7176
7176
  }
7177
7177
  startViewAnimation(t, n, r) {
7178
- Tc({
7178
+ this.resetZoomSnapStateForZoomChange(this.camera.getViewState().zoom, t.zoom), Tc({
7179
7179
  state: this.viewAnimationState,
7180
7180
  camera: this.camera,
7181
7181
  target: t,
@@ -7241,8 +7241,15 @@ class Uc {
7241
7241
  }
7242
7242
  return n;
7243
7243
  }
7244
+ resetZoomSnapState() {
7245
+ this.zoomSnapState.accumulatedDelta = 0, this.zoomSnapState.lastSnapTimeMs = 0, this.zoomSnapState.blockedDirection = null;
7246
+ }
7247
+ resetZoomSnapStateForZoomChange(t, n) {
7248
+ Math.abs(t - n) < 1e-6 || this.resetZoomSnapState();
7249
+ }
7244
7250
  applyViewStateAndRender(t, n = !0) {
7245
- n && this.cancelViewAnimation(), this.camera.setViewState(t), this.onViewStateChange?.(this.camera.getViewState()), this.requestRender();
7251
+ const r = this.camera.getViewState();
7252
+ n && this.cancelViewAnimation(), this.resetZoomSnapStateForZoomChange(r.zoom, t.zoom), this.camera.setViewState(t), this.onViewStateChange?.(this.camera.getViewState()), this.requestRender();
7246
7253
  }
7247
7254
  setAuthToken(t) {
7248
7255
  this.authToken = String(t ?? ""), this.tileScheduler.setAuthToken(this.authToken);
@@ -7251,7 +7258,7 @@ class Uc {
7251
7258
  const r = Ye(t), i = Ye(n);
7252
7259
  if (this.minZoomOverride === r && this.maxZoomOverride === i)
7253
7260
  return;
7254
- this.minZoomOverride = r, this.maxZoomOverride = i, this.applyZoomBounds();
7261
+ this.minZoomOverride = r, this.maxZoomOverride = i, this.applyZoomBounds(), this.resetZoomSnapState();
7255
7262
  const o = this.resolveTargetViewState({}), s = this.camera.getViewState();
7256
7263
  cr(s, o) || this.applyViewStateAndRender(o);
7257
7264
  }
@@ -7414,7 +7421,7 @@ class Uc {
7414
7421
  o && this.setViewState(o, i);
7415
7422
  }
7416
7423
  setZoomSnaps(t, n) {
7417
- this.zoomSnaps = ai(t, this.source.mpp), this.zoomSnapFitAsMin = !!n;
7424
+ this.zoomSnaps = ai(t, this.source.mpp), this.zoomSnapFitAsMin = !!n, this.resetZoomSnapState();
7418
7425
  }
7419
7426
  setPanExtent(t) {
7420
7427
  this.applyPanExtent(t);