@xviewer.js/core 1.0.0-alpha.38 → 1.0.0-alpha.39

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/module.js CHANGED
@@ -1408,7 +1408,11 @@ class CinestationBrain extends Component {
1408
1408
  lastUpdate(dt) {
1409
1409
  let vcam = this.getActiveCamera();
1410
1410
  if (vcam == null) return;
1411
- this._vcams.forEach((v)=>v.enabled = v === vcam);
1411
+ this._vcams.forEach((v)=>{
1412
+ if (!v.locked) {
1413
+ v.enabled = v === vcam;
1414
+ }
1415
+ });
1412
1416
  if (this._lerpTime < this.brainBlend.time) {
1413
1417
  this._lerpTime += dt;
1414
1418
  let t = clamp$4(this._lerpTime / this.brainBlend.time, 0, 1);
@@ -1437,7 +1441,7 @@ class CinestationBrain extends Component {
1437
1441
  }
1438
1442
  }
1439
1443
  getActiveCamera() {
1440
- return this._vcamSolo || this._vcams.filter((v)=>v.enabled).sort((a, b)=>b.priority - a.priority)[0];
1444
+ return this._vcamSolo || this._vcams.filter((v)=>v.enabled || v.locked).sort((a, b)=>b.priority - a.priority)[0];
1441
1445
  }
1442
1446
  _lerpToMainCamera(vcam, t) {
1443
1447
  const from = this.node, to = vcam;
@@ -1510,6 +1514,7 @@ class VirtualCamera extends Component {
1510
1514
  super(...args);
1511
1515
  this._finalPosition = new Vector3();
1512
1516
  this._finalRotation = new Quaternion();
1517
+ this.locked = false;
1513
1518
  this.priority = 10;
1514
1519
  this.lens = new Lens();
1515
1520
  this.correctPosition = new Vector3();
@@ -2801,9 +2806,10 @@ class FreelookVirtualCamera extends VirtualCamera {
2801
2806
  this._targetPhi = clamp(this._targetPhi, this.phiMin, this.phiMax);
2802
2807
  this._targetSpringLength = clamp(this._targetSpringLength, this.distanceMin, this.distanceMax);
2803
2808
  }
2804
- gotoPOI({ springLength = this._targetSpringLength, theta = this._targetTheta, phi = this._targetPhi, lookAt = this._lookAt, fov = this.lens.fov, smoothing = this.smoothing }) {
2809
+ gotoPOI({ duration = -1, easing = Easing.Cubic.InOut, springLength = this._targetSpringLength, theta = this._targetTheta, phi = this._targetPhi, lookAt = this._lookAt, fov = this.lens.fov, smoothing = this.smoothing }) {
2805
2810
  this._targetFov = fov;
2806
2811
  this._tempSmoothing = smoothing;
2812
+ this._targetLookAt.copy(lookAt);
2807
2813
  this._targetSpringLength = springLength;
2808
2814
  this._targetPhi = phi;
2809
2815
  this._targetTheta = theta;
@@ -2811,7 +2817,27 @@ class FreelookVirtualCamera extends VirtualCamera {
2811
2817
  const theta0 = MathUtils.euclideanModulo(this._spherical.theta, PI2);
2812
2818
  const theta1 = theta0 - PI2;
2813
2819
  this._spherical.theta = abs(theta0 - this._targetTheta) < abs(theta1 - this._targetTheta) ? theta0 : theta1;
2814
- this._targetLookAt.copy(lookAt);
2820
+ if (duration > 0) {
2821
+ this.locked = true;
2822
+ this.enabled = false;
2823
+ this.viewer.killTweensOf(this);
2824
+ this.viewer.timeline(this).to({
2825
+ springLength,
2826
+ theta,
2827
+ phi,
2828
+ lookAt,
2829
+ fov
2830
+ }, duration, {
2831
+ easing,
2832
+ onUpdate: ()=>{
2833
+ this.node.position.setFromSpherical(this._spherical).add(this._lookAt);
2834
+ this.node.lookAt(this._lookAt);
2835
+ }
2836
+ }).call(()=>{
2837
+ this.locked = false;
2838
+ this.enabled = true;
2839
+ }).start();
2840
+ }
2815
2841
  }
2816
2842
  update(dt) {
2817
2843
  const smoothing = this._tempSmoothing;