@kimap/indoor-positioning-sdk-vue2 5.8.8 → 5.9.0

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimap/indoor-positioning-sdk-vue2",
3
- "version": "5.8.8",
3
+ "version": "5.9.0",
4
4
  "description": "Vue2自包含室内定位SDK - 完全兼容Webpack3+Babel6 | Vue2 Self-Contained Indoor Positioning SDK",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -75,6 +75,7 @@ function SceneCore(config) {
75
75
  this.cameraPitchState = 0; // 0=正常视角, 1=ALL外景俯视
76
76
  this.cameraPrePitchPos = null; // 俯仰动画前的相机位置
77
77
  this.cameraPrePitchTarget = null; // 俯仰动画前的 controls.target
78
+ this._prevCameraPitchState = 0; // 上一帧的相机状态(用于检测状态变化触发动画)
78
79
  }
79
80
 
80
81
  /**
@@ -1290,7 +1291,11 @@ SceneCore.prototype.tickAnimations = function(deltaMs) {
1290
1291
  this.controls.target.copy(toTarget);
1291
1292
  this.controls.update();
1292
1293
  }
1294
+ // 动画结束:读取引入时保存的 targetState 归位
1295
+ var finishedTargetState = this.cameraPitchAnim ? this.cameraPitchAnim.targetState : 0;
1293
1296
  this.cameraPitchAnim = null;
1297
+ this.cameraPitchState = finishedTargetState;
1298
+ this.camera.lookAtTarget = toTarget.clone();
1294
1299
  }
1295
1300
  }
1296
1301
  };
@@ -1350,12 +1355,12 @@ SceneCore.prototype.animateCameraToAllView = function(duration) {
1350
1355
  this.cameraPrePitchPos = this.camera.position.clone();
1351
1356
  this.cameraPrePitchTarget = this.controls ? this.controls.target.clone() : center.clone();
1352
1357
 
1353
- // 较低俯角 -45°(-60°太极端):camera.y - center.y = distance × sin(-45°) ≈ -distance × 0.707
1354
- // camera.z - center.z = distance × cos(-45°) ≈ distance × 0.707
1355
- var dist = maxSize * 1.8; // 适度拉近,视野更舒适
1358
+ // ALL 外景俯角 -25°:camera.y - center.y = distance × sin(-25°) ≈ -distance × 0.423
1359
+ // camera.z - center.z = distance × cos(-25°) ≈ distance × 0.906
1360
+ var dist = maxSize * 2;
1356
1361
  var fromPos = this.camera.position.clone();
1357
1362
  var fromTarget = this.controls ? this.controls.target.clone() : center.clone();
1358
- var toPos = new THREE.Vector3(center.x, center.y - dist * 0.707, center.z + dist * 0.707);
1363
+ var toPos = new THREE.Vector3(center.x, center.y - dist * 0.423, center.z + dist * 0.906);
1359
1364
  var toTarget = new THREE.Vector3(center.x, center.y, center.z);
1360
1365
 
1361
1366
  this.cameraPitchAnim = {
@@ -1365,7 +1370,8 @@ SceneCore.prototype.animateCameraToAllView = function(duration) {
1365
1370
  fromPos: fromPos,
1366
1371
  toPos: toPos,
1367
1372
  fromTarget: fromTarget,
1368
- toTarget: toTarget
1373
+ toTarget: toTarget,
1374
+ targetState: 1 // 动画结束后 cameraPitchState 应为 1(ALL 状态)
1369
1375
  };
1370
1376
  this.cameraPitchState = 1;
1371
1377
  };