@thatopen/components 2.4.10 → 2.4.11
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/core/Components/index.d.ts +1 -1
- package/dist/index.cjs +34 -52
- package/dist/index.min.cjs +2 -2
- package/dist/index.min.mjs +2 -2
- package/dist/index.mjs +34 -52
- package/dist/namespace.d.ts +3798 -3798
- package/package.json +4 -5
package/dist/index.mjs
CHANGED
|
@@ -6590,7 +6590,7 @@ const _Components = class _Components {
|
|
|
6590
6590
|
/**
|
|
6591
6591
|
* The version of the @thatopen/components library.
|
|
6592
6592
|
*/
|
|
6593
|
-
__publicField(_Components, "release", "2.4.
|
|
6593
|
+
__publicField(_Components, "release", "2.4.11");
|
|
6594
6594
|
let Components = _Components;
|
|
6595
6595
|
class SimpleWorld extends Base {
|
|
6596
6596
|
constructor() {
|
|
@@ -7160,24 +7160,20 @@ const ACTION = Object.freeze({
|
|
|
7160
7160
|
NONE: 0,
|
|
7161
7161
|
ROTATE: 1,
|
|
7162
7162
|
TRUCK: 2,
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
TOUCH_ZOOM_TRUCK: 65536,
|
|
7178
|
-
TOUCH_ZOOM_OFFSET: 131072,
|
|
7179
|
-
TOUCH_ZOOM_SCREEN_PAN: 262144,
|
|
7180
|
-
TOUCH_ZOOM_ROTATE: 524288
|
|
7163
|
+
OFFSET: 4,
|
|
7164
|
+
DOLLY: 8,
|
|
7165
|
+
ZOOM: 16,
|
|
7166
|
+
TOUCH_ROTATE: 32,
|
|
7167
|
+
TOUCH_TRUCK: 64,
|
|
7168
|
+
TOUCH_OFFSET: 128,
|
|
7169
|
+
TOUCH_DOLLY: 256,
|
|
7170
|
+
TOUCH_ZOOM: 512,
|
|
7171
|
+
TOUCH_DOLLY_TRUCK: 1024,
|
|
7172
|
+
TOUCH_DOLLY_OFFSET: 2048,
|
|
7173
|
+
TOUCH_DOLLY_ROTATE: 4096,
|
|
7174
|
+
TOUCH_ZOOM_TRUCK: 8192,
|
|
7175
|
+
TOUCH_ZOOM_OFFSET: 16384,
|
|
7176
|
+
TOUCH_ZOOM_ROTATE: 32768
|
|
7181
7177
|
});
|
|
7182
7178
|
const DOLLY_DIRECTION = {
|
|
7183
7179
|
NONE: 0,
|
|
@@ -7377,7 +7373,7 @@ class EventDispatcher {
|
|
|
7377
7373
|
}
|
|
7378
7374
|
}
|
|
7379
7375
|
var _a;
|
|
7380
|
-
const VERSION = "2.
|
|
7376
|
+
const VERSION = "2.9.0";
|
|
7381
7377
|
const TOUCH_DOLLY_FACTOR = 1 / 8;
|
|
7382
7378
|
const isMac = /Mac/.test((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) === null || _a === void 0 ? void 0 : _a.platform);
|
|
7383
7379
|
let THREE;
|
|
@@ -7476,12 +7472,6 @@ class CameraControls extends EventDispatcher {
|
|
|
7476
7472
|
static get ACTION() {
|
|
7477
7473
|
return ACTION;
|
|
7478
7474
|
}
|
|
7479
|
-
/**
|
|
7480
|
-
* @deprecated Use `cameraControls.mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.
|
|
7481
|
-
*/
|
|
7482
|
-
set verticalDragToForward(_) {
|
|
7483
|
-
console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.");
|
|
7484
|
-
}
|
|
7485
7475
|
/**
|
|
7486
7476
|
* Creates a `CameraControls` instance.
|
|
7487
7477
|
*
|
|
@@ -7520,6 +7510,7 @@ class CameraControls extends EventDispatcher {
|
|
|
7520
7510
|
this.truckSpeed = 2;
|
|
7521
7511
|
this.dollyToCursor = false;
|
|
7522
7512
|
this.dragToOffset = false;
|
|
7513
|
+
this.verticalDragToForward = false;
|
|
7523
7514
|
this.boundaryFriction = 0;
|
|
7524
7515
|
this.restThreshold = 0.01;
|
|
7525
7516
|
this.colliderMeshes = [];
|
|
@@ -7552,7 +7543,7 @@ class CameraControls extends EventDispatcher {
|
|
|
7552
7543
|
this._targetVelocity = new THREE.Vector3();
|
|
7553
7544
|
this._focalOffsetVelocity = new THREE.Vector3();
|
|
7554
7545
|
this._zoomVelocity = { value: 0 };
|
|
7555
|
-
this._truckInternal = (deltaX, deltaY, dragToOffset
|
|
7546
|
+
this._truckInternal = (deltaX, deltaY, dragToOffset) => {
|
|
7556
7547
|
let truckX;
|
|
7557
7548
|
let pedestalY;
|
|
7558
7549
|
if (isPerspectiveCamera(this._camera)) {
|
|
@@ -7563,12 +7554,12 @@ class CameraControls extends EventDispatcher {
|
|
|
7563
7554
|
pedestalY = this.truckSpeed * deltaY * targetDistance / this._elementRect.height;
|
|
7564
7555
|
} else if (isOrthographicCamera(this._camera)) {
|
|
7565
7556
|
const camera2 = this._camera;
|
|
7566
|
-
truckX =
|
|
7567
|
-
pedestalY =
|
|
7557
|
+
truckX = deltaX * (camera2.right - camera2.left) / camera2.zoom / this._elementRect.width;
|
|
7558
|
+
pedestalY = deltaY * (camera2.top - camera2.bottom) / camera2.zoom / this._elementRect.height;
|
|
7568
7559
|
} else {
|
|
7569
7560
|
return;
|
|
7570
7561
|
}
|
|
7571
|
-
if (
|
|
7562
|
+
if (this.verticalDragToForward) {
|
|
7572
7563
|
dragToOffset ? this.setFocalOffset(this._focalOffsetEnd.x + truckX, this._focalOffsetEnd.y, this._focalOffsetEnd.z, true) : this.truck(truckX, 0, true);
|
|
7573
7564
|
this.forward(-pedestalY, true);
|
|
7574
7565
|
} else {
|
|
@@ -7771,7 +7762,7 @@ class CameraControls extends EventDispatcher {
|
|
|
7771
7762
|
lastScrollTimeStamp = now;
|
|
7772
7763
|
}
|
|
7773
7764
|
const deltaYFactor = isMac ? -1 : -3;
|
|
7774
|
-
const delta = event.deltaMode === 1
|
|
7765
|
+
const delta = event.deltaMode === 1 ? event.deltaY / deltaYFactor : event.deltaY / (deltaYFactor * 10);
|
|
7775
7766
|
const x = this.dollyToCursor ? (event.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0;
|
|
7776
7767
|
const y = this.dollyToCursor ? (event.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
7777
7768
|
switch (this.mouseButtons.wheel) {
|
|
@@ -7781,17 +7772,12 @@ class CameraControls extends EventDispatcher {
|
|
|
7781
7772
|
break;
|
|
7782
7773
|
}
|
|
7783
7774
|
case ACTION.TRUCK: {
|
|
7784
|
-
this._truckInternal(event.deltaX, event.deltaY, false
|
|
7785
|
-
this._isUserControllingTruck = true;
|
|
7786
|
-
break;
|
|
7787
|
-
}
|
|
7788
|
-
case ACTION.SCREEN_PAN: {
|
|
7789
|
-
this._truckInternal(event.deltaX, event.deltaY, false, true);
|
|
7775
|
+
this._truckInternal(event.deltaX, event.deltaY, false);
|
|
7790
7776
|
this._isUserControllingTruck = true;
|
|
7791
7777
|
break;
|
|
7792
7778
|
}
|
|
7793
7779
|
case ACTION.OFFSET: {
|
|
7794
|
-
this._truckInternal(event.deltaX, event.deltaY, true
|
|
7780
|
+
this._truckInternal(event.deltaX, event.deltaY, true);
|
|
7795
7781
|
this._isUserControllingOffset = true;
|
|
7796
7782
|
break;
|
|
7797
7783
|
}
|
|
@@ -7871,15 +7857,15 @@ class CameraControls extends EventDispatcher {
|
|
|
7871
7857
|
this._thetaVelocity.value = 0;
|
|
7872
7858
|
this._phiVelocity.value = 0;
|
|
7873
7859
|
}
|
|
7874
|
-
if ((this._state & ACTION.TRUCK) === ACTION.TRUCK || (this._state & ACTION.
|
|
7860
|
+
if ((this._state & ACTION.TRUCK) === ACTION.TRUCK || (this._state & ACTION.TOUCH_TRUCK) === ACTION.TOUCH_TRUCK || (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK) {
|
|
7875
7861
|
this._targetEnd.copy(this._target);
|
|
7876
7862
|
this._targetVelocity.set(0, 0, 0);
|
|
7877
7863
|
}
|
|
7878
|
-
if ((this._state & ACTION.DOLLY) === ACTION.DOLLY || (this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY || (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (this._state & ACTION.
|
|
7864
|
+
if ((this._state & ACTION.DOLLY) === ACTION.DOLLY || (this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY || (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET || (this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE) {
|
|
7879
7865
|
this._sphericalEnd.radius = this._spherical.radius;
|
|
7880
7866
|
this._radiusVelocity.value = 0;
|
|
7881
7867
|
}
|
|
7882
|
-
if ((this._state & ACTION.ZOOM) === ACTION.ZOOM || (this._state & ACTION.TOUCH_ZOOM) === ACTION.TOUCH_ZOOM || (this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK || (this._state & ACTION.
|
|
7868
|
+
if ((this._state & ACTION.ZOOM) === ACTION.ZOOM || (this._state & ACTION.TOUCH_ZOOM) === ACTION.TOUCH_ZOOM || (this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK || (this._state & ACTION.TOUCH_ZOOM_OFFSET) === ACTION.TOUCH_ZOOM_OFFSET || (this._state & ACTION.TOUCH_ZOOM_ROTATE) === ACTION.TOUCH_ZOOM_ROTATE) {
|
|
7883
7869
|
this._zoomEnd = this._zoom;
|
|
7884
7870
|
this._zoomVelocity.value = 0;
|
|
7885
7871
|
}
|
|
@@ -7915,7 +7901,7 @@ class CameraControls extends EventDispatcher {
|
|
|
7915
7901
|
this._isUserControllingZoom = true;
|
|
7916
7902
|
}
|
|
7917
7903
|
}
|
|
7918
|
-
if ((this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY || (this._state & ACTION.TOUCH_ZOOM) === ACTION.TOUCH_ZOOM || (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK || (this._state & ACTION.
|
|
7904
|
+
if ((this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY || (this._state & ACTION.TOUCH_ZOOM) === ACTION.TOUCH_ZOOM || (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK || (this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET || (this._state & ACTION.TOUCH_ZOOM_OFFSET) === ACTION.TOUCH_ZOOM_OFFSET || (this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE || (this._state & ACTION.TOUCH_ZOOM_ROTATE) === ACTION.TOUCH_ZOOM_ROTATE) {
|
|
7919
7905
|
const dx = _v2$1.x - this._activePointers[1].clientX;
|
|
7920
7906
|
const dy = _v2$1.y - this._activePointers[1].clientY;
|
|
7921
7907
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
@@ -7923,7 +7909,7 @@ class CameraControls extends EventDispatcher {
|
|
|
7923
7909
|
dollyStart.set(0, distance);
|
|
7924
7910
|
const dollyX = this.dollyToCursor ? (lastDragPosition.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0;
|
|
7925
7911
|
const dollyY = this.dollyToCursor ? (lastDragPosition.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
7926
|
-
if ((this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY || (this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE || (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (this._state & ACTION.
|
|
7912
|
+
if ((this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY || (this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE || (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET) {
|
|
7927
7913
|
this._dollyInternal(dollyDelta * TOUCH_DOLLY_FACTOR, dollyX, dollyY);
|
|
7928
7914
|
this._isUserControllingDolly = true;
|
|
7929
7915
|
} else {
|
|
@@ -7932,15 +7918,11 @@ class CameraControls extends EventDispatcher {
|
|
|
7932
7918
|
}
|
|
7933
7919
|
}
|
|
7934
7920
|
if ((this._state & ACTION.TRUCK) === ACTION.TRUCK || (this._state & ACTION.TOUCH_TRUCK) === ACTION.TOUCH_TRUCK || (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK) {
|
|
7935
|
-
this._truckInternal(deltaX, deltaY, false
|
|
7936
|
-
this._isUserControllingTruck = true;
|
|
7937
|
-
}
|
|
7938
|
-
if ((this._state & ACTION.SCREEN_PAN) === ACTION.SCREEN_PAN || (this._state & ACTION.TOUCH_SCREEN_PAN) === ACTION.TOUCH_SCREEN_PAN || (this._state & ACTION.TOUCH_DOLLY_SCREEN_PAN) === ACTION.TOUCH_DOLLY_SCREEN_PAN || (this._state & ACTION.TOUCH_ZOOM_SCREEN_PAN) === ACTION.TOUCH_ZOOM_SCREEN_PAN) {
|
|
7939
|
-
this._truckInternal(deltaX, deltaY, false, true);
|
|
7921
|
+
this._truckInternal(deltaX, deltaY, false);
|
|
7940
7922
|
this._isUserControllingTruck = true;
|
|
7941
7923
|
}
|
|
7942
7924
|
if ((this._state & ACTION.OFFSET) === ACTION.OFFSET || (this._state & ACTION.TOUCH_OFFSET) === ACTION.TOUCH_OFFSET || (this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET || (this._state & ACTION.TOUCH_ZOOM_OFFSET) === ACTION.TOUCH_ZOOM_OFFSET) {
|
|
7943
|
-
this._truckInternal(deltaX, deltaY, true
|
|
7925
|
+
this._truckInternal(deltaX, deltaY, true);
|
|
7944
7926
|
this._isUserControllingOffset = true;
|
|
7945
7927
|
}
|
|
7946
7928
|
this.dispatchEvent({ type: "control" });
|
|
@@ -9003,6 +8985,7 @@ class CameraControls extends EventDispatcher {
|
|
|
9003
8985
|
this._camera.lookAt(this._target);
|
|
9004
8986
|
const affectOffset = !approxZero(this._focalOffset.x) || !approxZero(this._focalOffset.y) || !approxZero(this._focalOffset.z);
|
|
9005
8987
|
if (affectOffset) {
|
|
8988
|
+
this._camera.updateMatrixWorld();
|
|
9006
8989
|
_xColumn.setFromMatrixColumn(this._camera.matrix, 0);
|
|
9007
8990
|
_yColumn.setFromMatrixColumn(this._camera.matrix, 1);
|
|
9008
8991
|
_zColumn.setFromMatrixColumn(this._camera.matrix, 2);
|
|
@@ -9011,7 +8994,6 @@ class CameraControls extends EventDispatcher {
|
|
|
9011
8994
|
_zColumn.multiplyScalar(this._focalOffset.z);
|
|
9012
8995
|
_v3A.copy(_xColumn).add(_yColumn).add(_zColumn);
|
|
9013
8996
|
this._camera.position.add(_v3A);
|
|
9014
|
-
this._camera.updateMatrixWorld();
|
|
9015
8997
|
}
|
|
9016
8998
|
if (this._boundaryEnclosesCamera) {
|
|
9017
8999
|
this._encloseToBoundary(this._camera.position.copy(this._target), _v3A.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
|
|
@@ -9056,6 +9038,7 @@ class CameraControls extends EventDispatcher {
|
|
|
9056
9038
|
dollySpeed: this.dollySpeed,
|
|
9057
9039
|
truckSpeed: this.truckSpeed,
|
|
9058
9040
|
dollyToCursor: this.dollyToCursor,
|
|
9041
|
+
verticalDragToForward: this.verticalDragToForward,
|
|
9059
9042
|
target: this._targetEnd.toArray(),
|
|
9060
9043
|
position: _v3A.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
9061
9044
|
zoom: this._zoomEnd,
|
|
@@ -9088,6 +9071,7 @@ class CameraControls extends EventDispatcher {
|
|
|
9088
9071
|
this.dollySpeed = obj.dollySpeed;
|
|
9089
9072
|
this.truckSpeed = obj.truckSpeed;
|
|
9090
9073
|
this.dollyToCursor = obj.dollyToCursor;
|
|
9074
|
+
this.verticalDragToForward = obj.verticalDragToForward;
|
|
9091
9075
|
this._target0.fromArray(obj.target0);
|
|
9092
9076
|
this._position0.fromArray(obj.position0);
|
|
9093
9077
|
this._zoom0 = obj.zoom0;
|
|
@@ -9303,8 +9287,6 @@ class CameraControls extends EventDispatcher {
|
|
|
9303
9287
|
if (!object.isMesh)
|
|
9304
9288
|
return;
|
|
9305
9289
|
const mesh = object;
|
|
9306
|
-
if (!mesh.geometry)
|
|
9307
|
-
return;
|
|
9308
9290
|
const geometry = mesh.geometry.clone();
|
|
9309
9291
|
geometry.applyMatrix4(mesh.matrixWorld);
|
|
9310
9292
|
const bufferGeometry = geometry;
|