@xviewer.js/core 1.0.0-alpha.52 → 1.0.0-alpha.54
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/main.js +15 -14
- package/dist/main.js.map +1 -1
- package/dist/module.js +15 -14
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/Viewer.d.ts +3 -0
package/dist/main.js
CHANGED
|
@@ -1483,19 +1483,13 @@ class Lens {
|
|
|
1483
1483
|
}
|
|
1484
1484
|
}
|
|
1485
1485
|
__decorate([
|
|
1486
|
-
property
|
|
1487
|
-
dir: "lens"
|
|
1488
|
-
})
|
|
1486
|
+
property
|
|
1489
1487
|
], Lens.prototype, "fov", void 0);
|
|
1490
1488
|
__decorate([
|
|
1491
|
-
property
|
|
1492
|
-
dir: "lens"
|
|
1493
|
-
})
|
|
1489
|
+
property
|
|
1494
1490
|
], Lens.prototype, "near", void 0);
|
|
1495
1491
|
__decorate([
|
|
1496
|
-
property
|
|
1497
|
-
dir: "lens"
|
|
1498
|
-
})
|
|
1492
|
+
property
|
|
1499
1493
|
], Lens.prototype, "far", void 0);
|
|
1500
1494
|
class VirtualCamera extends Component {
|
|
1501
1495
|
get finalPosition() {
|
|
@@ -2720,6 +2714,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2720
2714
|
} else if (e.deltaY < 0) {
|
|
2721
2715
|
this._targetSpringLength *= this._calculateDistanceScale(0.85);
|
|
2722
2716
|
}
|
|
2717
|
+
this._calculateTargetSpringArm();
|
|
2723
2718
|
}
|
|
2724
2719
|
_onTouchStart(e) {
|
|
2725
2720
|
if (!SystemInfo.isMobile) return;
|
|
@@ -2746,6 +2741,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2746
2741
|
__center.copy(__loc0).add(__loc1).multiplyScalar(0.5);
|
|
2747
2742
|
this._calculatePanDelta(__panDelta, __preCenter, __center);
|
|
2748
2743
|
this._calculateTargetLookAt(__panDelta);
|
|
2744
|
+
this._calculateTargetSpringArm();
|
|
2749
2745
|
this._preLoc0.copy(__loc0);
|
|
2750
2746
|
this._preLoc1.copy(__loc1);
|
|
2751
2747
|
} else if (touches.length > 0) {
|
|
@@ -2767,7 +2763,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2767
2763
|
_calculateRotatelDelta(out, loc0, loc1) {
|
|
2768
2764
|
this._tempRotateSmoothing = this.rotateSmoothing;
|
|
2769
2765
|
const domElement = this.viewer.canvas;
|
|
2770
|
-
out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / domElement.
|
|
2766
|
+
out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / domElement.clientHeight);
|
|
2771
2767
|
out.y = -out.y;
|
|
2772
2768
|
if (this.forbidX) {
|
|
2773
2769
|
out.x = 0;
|
|
@@ -2780,7 +2776,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2780
2776
|
_calculatePanDelta(out, loc0, loc1) {
|
|
2781
2777
|
this._tempRotateSmoothing = this.rotateSmoothing;
|
|
2782
2778
|
const domElement = this.viewer.canvas;
|
|
2783
|
-
out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / domElement.
|
|
2779
|
+
out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / domElement.clientHeight);
|
|
2784
2780
|
if (this.forbidPanX) {
|
|
2785
2781
|
out.x = 0;
|
|
2786
2782
|
}
|
|
@@ -2870,10 +2866,10 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2870
2866
|
this._touchID = -1;
|
|
2871
2867
|
this._preLoc0 = new three.Vector2();
|
|
2872
2868
|
this._preLoc1 = new three.Vector2();
|
|
2873
|
-
this._spherical = new three.Spherical(
|
|
2869
|
+
this._spherical = new three.Spherical(2, Math.PI / 2);
|
|
2874
2870
|
this._lookAt = new three.Vector3();
|
|
2875
2871
|
this._tempSmoothing = 6;
|
|
2876
|
-
this._tempRotateSmoothing =
|
|
2872
|
+
this._tempRotateSmoothing = 8;
|
|
2877
2873
|
this._targetTheta = 0;
|
|
2878
2874
|
this._targetPhi = 0;
|
|
2879
2875
|
this._targetSpringLength = 1;
|
|
@@ -2888,7 +2884,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2888
2884
|
this.panSpeed = 1;
|
|
2889
2885
|
this.rotateSpeed = 1;
|
|
2890
2886
|
this.smoothing = 5;
|
|
2891
|
-
this.rotateSmoothing =
|
|
2887
|
+
this.rotateSmoothing = 8;
|
|
2892
2888
|
this.phiMin = ESP;
|
|
2893
2889
|
this.phiMax = Math.PI - ESP;
|
|
2894
2890
|
this.thetaMin = -Infinity;
|
|
@@ -4561,6 +4557,9 @@ class Viewer extends EventEmitter {
|
|
|
4561
4557
|
static getMesh(node, name, group = false) {
|
|
4562
4558
|
return Viewer._getObjectValue(node.userData.meshes, name, group);
|
|
4563
4559
|
}
|
|
4560
|
+
get instanceId() {
|
|
4561
|
+
return this._instanceId;
|
|
4562
|
+
}
|
|
4564
4563
|
get root() {
|
|
4565
4564
|
return this._root;
|
|
4566
4565
|
}
|
|
@@ -4931,6 +4930,7 @@ class Viewer extends EventEmitter {
|
|
|
4931
4930
|
position: new three.Vector3(0, 0, 4)
|
|
4932
4931
|
}, targetFrameRate = -1, fixedFrameTime = false, colorSpace = three.SRGBColorSpace, toneMapping = three.LinearToneMapping, toneMappingExposure = 1, maxDPR = 1.5, path = "", resourcePath = "", dracoPath = "https://www.gstatic.com/draco/v1/decoders/", orientation = exports.Orientation.AUTO, loader = {}, tasker = {}, ...webglOpts } = {}){
|
|
4933
4932
|
super();
|
|
4933
|
+
this._instanceId = Viewer._instanceCount++;
|
|
4934
4934
|
this._dpr = 1;
|
|
4935
4935
|
this._width = 1;
|
|
4936
4936
|
this._height = 1;
|
|
@@ -5005,6 +5005,7 @@ Viewer._shadowCameraKeys = [
|
|
|
5005
5005
|
Viewer.__emtpyObject = {};
|
|
5006
5006
|
Viewer.fullscreenMesh = new three.Mesh(Viewer.createFullscreenTriangle());
|
|
5007
5007
|
Viewer.fullscreenCamera = new three.OrthographicCamera(-1, 1, 1, -1, 0, 1);
|
|
5008
|
+
Viewer._instanceCount = 0;
|
|
5008
5009
|
|
|
5009
5010
|
class MergeRefectPass {
|
|
5010
5011
|
get envMapTarget() {
|