@thatopen/components 2.4.8 → 2.4.10
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/core/Cullers/src/mesh-culler-renderer.d.ts +1 -1
- package/dist/index.cjs +661 -310
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.mjs +3 -3
- package/dist/index.mjs +662 -311
- package/dist/namespace.d.ts +3980 -3980
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -4021,6 +4021,9 @@ const _plane = new THREE$1.Plane();
|
|
|
4021
4021
|
const _closestPoint = new THREE$1.Vector3();
|
|
4022
4022
|
const _triangle = new THREE$1.Triangle();
|
|
4023
4023
|
class ConvexHull {
|
|
4024
|
+
/**
|
|
4025
|
+
* Constructs a new convex hull.
|
|
4026
|
+
*/
|
|
4024
4027
|
constructor() {
|
|
4025
4028
|
this.tolerance = -1;
|
|
4026
4029
|
this.faces = [];
|
|
@@ -4029,16 +4032,29 @@ class ConvexHull {
|
|
|
4029
4032
|
this.unassigned = new VertexList();
|
|
4030
4033
|
this.vertices = [];
|
|
4031
4034
|
}
|
|
4035
|
+
/**
|
|
4036
|
+
* Computes to convex hull for the given array of points.
|
|
4037
|
+
*
|
|
4038
|
+
* @param {Array<Vector3>} points - The array of points in 3D space.
|
|
4039
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4040
|
+
*/
|
|
4032
4041
|
setFromPoints(points) {
|
|
4033
4042
|
if (points.length >= 4) {
|
|
4034
4043
|
this.makeEmpty();
|
|
4035
4044
|
for (let i = 0, l = points.length; i < l; i++) {
|
|
4036
4045
|
this.vertices.push(new VertexNode(points[i]));
|
|
4037
4046
|
}
|
|
4038
|
-
this.
|
|
4047
|
+
this._compute();
|
|
4039
4048
|
}
|
|
4040
4049
|
return this;
|
|
4041
4050
|
}
|
|
4051
|
+
/**
|
|
4052
|
+
* Computes the convex hull of the given 3D object (including its descendants),
|
|
4053
|
+
* accounting for the world transforms of both the 3D object and its descendants.
|
|
4054
|
+
*
|
|
4055
|
+
* @param {Object3D} object - The 3D object to compute the convex hull for.
|
|
4056
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4057
|
+
*/
|
|
4042
4058
|
setFromObject(object) {
|
|
4043
4059
|
const points = [];
|
|
4044
4060
|
object.updateMatrixWorld(true);
|
|
@@ -4057,6 +4073,12 @@ class ConvexHull {
|
|
|
4057
4073
|
});
|
|
4058
4074
|
return this.setFromPoints(points);
|
|
4059
4075
|
}
|
|
4076
|
+
/**
|
|
4077
|
+
* Returns `true` if the given point lies in the convex hull.
|
|
4078
|
+
*
|
|
4079
|
+
* @param {Vector3} point - The point to test.
|
|
4080
|
+
* @return {boolean} Whether the given point lies in the convex hull or not.
|
|
4081
|
+
*/
|
|
4060
4082
|
containsPoint(point) {
|
|
4061
4083
|
const faces = this.faces;
|
|
4062
4084
|
for (let i = 0, l = faces.length; i < l; i++) {
|
|
@@ -4066,6 +4088,13 @@ class ConvexHull {
|
|
|
4066
4088
|
}
|
|
4067
4089
|
return true;
|
|
4068
4090
|
}
|
|
4091
|
+
/**
|
|
4092
|
+
* Computes the intersections point of the given ray and this convex hull.
|
|
4093
|
+
*
|
|
4094
|
+
* @param {Ray} ray - The ray to test.
|
|
4095
|
+
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
4096
|
+
* @return {Vector3|null} The intersection point. Returns `null` if not intersection was detected.
|
|
4097
|
+
*/
|
|
4069
4098
|
intersectRay(ray2, target) {
|
|
4070
4099
|
const faces = this.faces;
|
|
4071
4100
|
let tNear = -Infinity;
|
|
@@ -4095,16 +4124,35 @@ class ConvexHull {
|
|
|
4095
4124
|
}
|
|
4096
4125
|
return target;
|
|
4097
4126
|
}
|
|
4127
|
+
/**
|
|
4128
|
+
* Returns `true` if the given ray intersects with this convex hull.
|
|
4129
|
+
*
|
|
4130
|
+
* @param {Ray} ray - The ray to test.
|
|
4131
|
+
* @return {boolean} Whether the given ray intersects with this convex hull or not.
|
|
4132
|
+
*/
|
|
4098
4133
|
intersectsRay(ray2) {
|
|
4099
4134
|
return this.intersectRay(ray2, _v1$1) !== null;
|
|
4100
4135
|
}
|
|
4136
|
+
/**
|
|
4137
|
+
* Makes the convex hull empty.
|
|
4138
|
+
*
|
|
4139
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4140
|
+
*/
|
|
4101
4141
|
makeEmpty() {
|
|
4102
4142
|
this.faces = [];
|
|
4103
4143
|
this.vertices = [];
|
|
4104
4144
|
return this;
|
|
4105
4145
|
}
|
|
4106
|
-
//
|
|
4107
|
-
|
|
4146
|
+
// private
|
|
4147
|
+
/**
|
|
4148
|
+
* Adds a vertex to the 'assigned' list of vertices and assigns it to the given face.
|
|
4149
|
+
*
|
|
4150
|
+
* @private
|
|
4151
|
+
* @param {VertexNode} vertex - The vertex to add.
|
|
4152
|
+
* @param {Face} face - The target face.
|
|
4153
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4154
|
+
*/
|
|
4155
|
+
_addVertexToFace(vertex, face) {
|
|
4108
4156
|
vertex.face = face;
|
|
4109
4157
|
if (face.outside === null) {
|
|
4110
4158
|
this.assigned.append(vertex);
|
|
@@ -4114,8 +4162,17 @@ class ConvexHull {
|
|
|
4114
4162
|
face.outside = vertex;
|
|
4115
4163
|
return this;
|
|
4116
4164
|
}
|
|
4117
|
-
|
|
4118
|
-
|
|
4165
|
+
/**
|
|
4166
|
+
* Removes a vertex from the 'assigned' list of vertices and from the given face.
|
|
4167
|
+
* It also makes sure that the link from 'face' to the first vertex it sees in 'assigned'
|
|
4168
|
+
* is linked correctly after the removal.
|
|
4169
|
+
*
|
|
4170
|
+
* @private
|
|
4171
|
+
* @param {VertexNode} vertex - The vertex to remove.
|
|
4172
|
+
* @param {Face} face - The target face.
|
|
4173
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4174
|
+
*/
|
|
4175
|
+
_removeVertexFromFace(vertex, face) {
|
|
4119
4176
|
if (vertex === face.outside) {
|
|
4120
4177
|
if (vertex.next !== null && vertex.next.face === face) {
|
|
4121
4178
|
face.outside = vertex.next;
|
|
@@ -4126,8 +4183,15 @@ class ConvexHull {
|
|
|
4126
4183
|
this.assigned.remove(vertex);
|
|
4127
4184
|
return this;
|
|
4128
4185
|
}
|
|
4129
|
-
|
|
4130
|
-
|
|
4186
|
+
/**
|
|
4187
|
+
* Removes all the visible vertices that a given face is able to see which are stored in
|
|
4188
|
+
* the 'assigned' vertex list.
|
|
4189
|
+
*
|
|
4190
|
+
* @private
|
|
4191
|
+
* @param {Face} face - The target face.
|
|
4192
|
+
* @return {VertexNode|undefined} A reference to this convex hull.
|
|
4193
|
+
*/
|
|
4194
|
+
_removeAllVerticesFromFace(face) {
|
|
4131
4195
|
if (face.outside !== null) {
|
|
4132
4196
|
const start = face.outside;
|
|
4133
4197
|
let end = face.outside;
|
|
@@ -4140,9 +4204,20 @@ class ConvexHull {
|
|
|
4140
4204
|
return start;
|
|
4141
4205
|
}
|
|
4142
4206
|
}
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4207
|
+
/**
|
|
4208
|
+
* Removes all the visible vertices that `face` is able to see.
|
|
4209
|
+
*
|
|
4210
|
+
* - If `absorbingFace` doesn't exist, then all the removed vertices will be added to the 'unassigned' vertex list.
|
|
4211
|
+
* - If `absorbingFace` exists, then this method will assign all the vertices of 'face' that can see 'absorbingFace'.
|
|
4212
|
+
* - If a vertex cannot see `absorbingFace`, it's added to the 'unassigned' vertex list.
|
|
4213
|
+
*
|
|
4214
|
+
* @private
|
|
4215
|
+
* @param {Face} face - The given face.
|
|
4216
|
+
* @param {Face} [absorbingFace] - An optional face that tries to absorb the vertices of the first face.
|
|
4217
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4218
|
+
*/
|
|
4219
|
+
_deleteFaceVertices(face, absorbingFace) {
|
|
4220
|
+
const faceVertices = this._removeAllVerticesFromFace(face);
|
|
4146
4221
|
if (faceVertices !== void 0) {
|
|
4147
4222
|
if (absorbingFace === void 0) {
|
|
4148
4223
|
this.unassigned.appendChain(faceVertices);
|
|
@@ -4152,7 +4227,7 @@ class ConvexHull {
|
|
|
4152
4227
|
const nextVertex = vertex.next;
|
|
4153
4228
|
const distance = absorbingFace.distanceToPoint(vertex.point);
|
|
4154
4229
|
if (distance > this.tolerance) {
|
|
4155
|
-
this.
|
|
4230
|
+
this._addVertexToFace(vertex, absorbingFace);
|
|
4156
4231
|
} else {
|
|
4157
4232
|
this.unassigned.append(vertex);
|
|
4158
4233
|
}
|
|
@@ -4162,8 +4237,14 @@ class ConvexHull {
|
|
|
4162
4237
|
}
|
|
4163
4238
|
return this;
|
|
4164
4239
|
}
|
|
4165
|
-
|
|
4166
|
-
|
|
4240
|
+
/**
|
|
4241
|
+
* Reassigns as many vertices as possible from the unassigned list to the new faces.
|
|
4242
|
+
*
|
|
4243
|
+
* @private
|
|
4244
|
+
* @param {Array<Face>} newFaces - The new faces.
|
|
4245
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4246
|
+
*/
|
|
4247
|
+
_resolveUnassignedPoints(newFaces) {
|
|
4167
4248
|
if (this.unassigned.isEmpty() === false) {
|
|
4168
4249
|
let vertex = this.unassigned.first();
|
|
4169
4250
|
do {
|
|
@@ -4183,15 +4264,21 @@ class ConvexHull {
|
|
|
4183
4264
|
}
|
|
4184
4265
|
}
|
|
4185
4266
|
if (maxFace !== null) {
|
|
4186
|
-
this.
|
|
4267
|
+
this._addVertexToFace(vertex, maxFace);
|
|
4187
4268
|
}
|
|
4188
4269
|
vertex = nextVertex;
|
|
4189
4270
|
} while (vertex !== null);
|
|
4190
4271
|
}
|
|
4191
4272
|
return this;
|
|
4192
4273
|
}
|
|
4193
|
-
|
|
4194
|
-
|
|
4274
|
+
/**
|
|
4275
|
+
* Computes the extremes values (min/max vectors) which will be used to
|
|
4276
|
+
* compute the initial hull.
|
|
4277
|
+
*
|
|
4278
|
+
* @private
|
|
4279
|
+
* @return {Object} The extremes.
|
|
4280
|
+
*/
|
|
4281
|
+
_computeExtremes() {
|
|
4195
4282
|
const min = new THREE$1.Vector3();
|
|
4196
4283
|
const max = new THREE$1.Vector3();
|
|
4197
4284
|
const minVertices = [];
|
|
@@ -4220,11 +4307,16 @@ class ConvexHull {
|
|
|
4220
4307
|
this.tolerance = 3 * Number.EPSILON * (Math.max(Math.abs(min.x), Math.abs(max.x)) + Math.max(Math.abs(min.y), Math.abs(max.y)) + Math.max(Math.abs(min.z), Math.abs(max.z)));
|
|
4221
4308
|
return { min: minVertices, max: maxVertices };
|
|
4222
4309
|
}
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4310
|
+
/**
|
|
4311
|
+
* Computes the initial simplex assigning to its faces all the points that are
|
|
4312
|
+
* candidates to form part of the hull.
|
|
4313
|
+
*
|
|
4314
|
+
* @private
|
|
4315
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4316
|
+
*/
|
|
4317
|
+
_computeInitialHull() {
|
|
4226
4318
|
const vertices = this.vertices;
|
|
4227
|
-
const extremes = this.
|
|
4319
|
+
const extremes = this._computeExtremes();
|
|
4228
4320
|
const min = extremes.min;
|
|
4229
4321
|
const max = extremes.max;
|
|
4230
4322
|
let maxDistance = 0;
|
|
@@ -4307,14 +4399,19 @@ class ConvexHull {
|
|
|
4307
4399
|
}
|
|
4308
4400
|
}
|
|
4309
4401
|
if (maxFace !== null) {
|
|
4310
|
-
this.
|
|
4402
|
+
this._addVertexToFace(vertex, maxFace);
|
|
4311
4403
|
}
|
|
4312
4404
|
}
|
|
4313
4405
|
}
|
|
4314
4406
|
return this;
|
|
4315
4407
|
}
|
|
4316
|
-
|
|
4317
|
-
|
|
4408
|
+
/**
|
|
4409
|
+
* Removes inactive (e.g. deleted) faces from the internal face list.
|
|
4410
|
+
*
|
|
4411
|
+
* @private
|
|
4412
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4413
|
+
*/
|
|
4414
|
+
_reindexFaces() {
|
|
4318
4415
|
const activeFaces = [];
|
|
4319
4416
|
for (let i = 0; i < this.faces.length; i++) {
|
|
4320
4417
|
const face = this.faces[i];
|
|
@@ -4325,8 +4422,17 @@ class ConvexHull {
|
|
|
4325
4422
|
this.faces = activeFaces;
|
|
4326
4423
|
return this;
|
|
4327
4424
|
}
|
|
4328
|
-
|
|
4329
|
-
|
|
4425
|
+
/**
|
|
4426
|
+
* Finds the next vertex to create faces with the current hull.
|
|
4427
|
+
*
|
|
4428
|
+
* - Let the initial face be the first face existing in the 'assigned' vertex list.
|
|
4429
|
+
* - If a face doesn't exist then return since there're no vertices left.
|
|
4430
|
+
* - Otherwise for each vertex that face sees find the one furthest away from it.
|
|
4431
|
+
*
|
|
4432
|
+
* @private
|
|
4433
|
+
* @return {?VertexNode} The next vertex to add.
|
|
4434
|
+
*/
|
|
4435
|
+
_nextVertexToAdd() {
|
|
4330
4436
|
if (this.assigned.isEmpty() === false) {
|
|
4331
4437
|
let eyeVertex, maxDistance = 0;
|
|
4332
4438
|
const eyeFace = this.assigned.first().face;
|
|
@@ -4342,11 +4448,20 @@ class ConvexHull {
|
|
|
4342
4448
|
return eyeVertex;
|
|
4343
4449
|
}
|
|
4344
4450
|
}
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4451
|
+
/**
|
|
4452
|
+
* Computes a chain of half edges in CCW order called the 'horizon'. For an edge
|
|
4453
|
+
* to be part of the horizon it must join a face that can see 'eyePoint' and a face
|
|
4454
|
+
* that cannot see 'eyePoint'.
|
|
4455
|
+
*
|
|
4456
|
+
* @private
|
|
4457
|
+
* @param {Vector3} eyePoint - The 3D-coordinates of a point.
|
|
4458
|
+
* @param {HalfEdge} crossEdge - The edge used to jump to the current face.
|
|
4459
|
+
* @param {Face} face - The current face being tested.
|
|
4460
|
+
* @param {Array<HalfEdge>} horizon - The edges that form part of the horizon in CCW order.
|
|
4461
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4462
|
+
*/
|
|
4463
|
+
_computeHorizon(eyePoint, crossEdge, face, horizon) {
|
|
4464
|
+
this._deleteFaceVertices(face);
|
|
4350
4465
|
face.mark = Deleted;
|
|
4351
4466
|
let edge;
|
|
4352
4467
|
if (crossEdge === null) {
|
|
@@ -4359,7 +4474,7 @@ class ConvexHull {
|
|
|
4359
4474
|
const oppositeFace = twinEdge.face;
|
|
4360
4475
|
if (oppositeFace.mark === Visible) {
|
|
4361
4476
|
if (oppositeFace.distanceToPoint(eyePoint) > this.tolerance) {
|
|
4362
|
-
this.
|
|
4477
|
+
this._computeHorizon(eyePoint, twinEdge, oppositeFace, horizon);
|
|
4363
4478
|
} else {
|
|
4364
4479
|
horizon.push(edge);
|
|
4365
4480
|
}
|
|
@@ -4368,22 +4483,38 @@ class ConvexHull {
|
|
|
4368
4483
|
} while (edge !== crossEdge);
|
|
4369
4484
|
return this;
|
|
4370
4485
|
}
|
|
4371
|
-
|
|
4372
|
-
|
|
4486
|
+
/**
|
|
4487
|
+
* Creates a face with the vertices 'eyeVertex.point', 'horizonEdge.tail' and 'horizonEdge.head'
|
|
4488
|
+
* in CCW order. All the half edges are created in CCW order thus the face is always pointing
|
|
4489
|
+
* outside the hull.
|
|
4490
|
+
*
|
|
4491
|
+
* @private
|
|
4492
|
+
* @param {VertexNode} eyeVertex - The vertex that is added to the hull.
|
|
4493
|
+
* @param {HalfEdge} horizonEdge - A single edge of the horizon.
|
|
4494
|
+
* @return {HalfEdge} The half edge whose vertex is the eyeVertex.
|
|
4495
|
+
*/
|
|
4496
|
+
_addAdjoiningFace(eyeVertex, horizonEdge) {
|
|
4373
4497
|
const face = Face.create(eyeVertex, horizonEdge.tail(), horizonEdge.head());
|
|
4374
4498
|
this.faces.push(face);
|
|
4375
4499
|
face.getEdge(-1).setTwin(horizonEdge.twin);
|
|
4376
4500
|
return face.getEdge(0);
|
|
4377
4501
|
}
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4502
|
+
/**
|
|
4503
|
+
* Adds 'horizon.length' faces to the hull, each face will be linked with the horizon
|
|
4504
|
+
* opposite face and the face on the left/right.
|
|
4505
|
+
*
|
|
4506
|
+
* @private
|
|
4507
|
+
* @param {VertexNode} eyeVertex - The vertex that is added to the hull.
|
|
4508
|
+
* @param {Array<HalfEdge>} horizon - The horizon.
|
|
4509
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4510
|
+
*/
|
|
4511
|
+
_addNewFaces(eyeVertex, horizon) {
|
|
4381
4512
|
this.newFaces = [];
|
|
4382
4513
|
let firstSideEdge = null;
|
|
4383
4514
|
let previousSideEdge = null;
|
|
4384
4515
|
for (let i = 0; i < horizon.length; i++) {
|
|
4385
4516
|
const horizonEdge = horizon[i];
|
|
4386
|
-
const sideEdge = this.
|
|
4517
|
+
const sideEdge = this._addAdjoiningFace(eyeVertex, horizonEdge);
|
|
4387
4518
|
if (firstSideEdge === null) {
|
|
4388
4519
|
firstSideEdge = sideEdge;
|
|
4389
4520
|
} else {
|
|
@@ -4395,34 +4526,62 @@ class ConvexHull {
|
|
|
4395
4526
|
firstSideEdge.next.setTwin(previousSideEdge);
|
|
4396
4527
|
return this;
|
|
4397
4528
|
}
|
|
4398
|
-
|
|
4399
|
-
|
|
4529
|
+
/**
|
|
4530
|
+
* Adds a vertex to the hull with the following algorithm:
|
|
4531
|
+
*
|
|
4532
|
+
* - Compute the 'horizon' which is a chain of half edges. For an edge to belong to this group
|
|
4533
|
+
* it must be the edge connecting a face that can see 'eyeVertex' and a face which cannot see 'eyeVertex'.
|
|
4534
|
+
* - All the faces that can see 'eyeVertex' have its visible vertices removed from the assigned vertex list.
|
|
4535
|
+
* - A new set of faces is created with each edge of the 'horizon' and 'eyeVertex'. Each face is connected
|
|
4536
|
+
* with the opposite horizon face and the face on the left/right.
|
|
4537
|
+
* - The vertices removed from all the visible faces are assigned to the new faces if possible.
|
|
4538
|
+
*
|
|
4539
|
+
* @private
|
|
4540
|
+
* @param {VertexNode} eyeVertex - The vertex to add.
|
|
4541
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4542
|
+
*/
|
|
4543
|
+
_addVertexToHull(eyeVertex) {
|
|
4400
4544
|
const horizon = [];
|
|
4401
4545
|
this.unassigned.clear();
|
|
4402
|
-
this.
|
|
4403
|
-
this.
|
|
4404
|
-
this.
|
|
4405
|
-
this.
|
|
4546
|
+
this._removeVertexFromFace(eyeVertex, eyeVertex.face);
|
|
4547
|
+
this._computeHorizon(eyeVertex.point, null, eyeVertex.face, horizon);
|
|
4548
|
+
this._addNewFaces(eyeVertex, horizon);
|
|
4549
|
+
this._resolveUnassignedPoints(this.newFaces);
|
|
4406
4550
|
return this;
|
|
4407
4551
|
}
|
|
4408
|
-
|
|
4552
|
+
/**
|
|
4553
|
+
* Cleans up internal properties after computing the convex hull.
|
|
4554
|
+
*
|
|
4555
|
+
* @private
|
|
4556
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4557
|
+
*/
|
|
4558
|
+
_cleanup() {
|
|
4409
4559
|
this.assigned.clear();
|
|
4410
4560
|
this.unassigned.clear();
|
|
4411
4561
|
this.newFaces = [];
|
|
4412
4562
|
return this;
|
|
4413
4563
|
}
|
|
4414
|
-
|
|
4564
|
+
/**
|
|
4565
|
+
* Starts the execution of the quick hull algorithm.
|
|
4566
|
+
*
|
|
4567
|
+
* @private
|
|
4568
|
+
* @return {ConvexHull} A reference to this convex hull.
|
|
4569
|
+
*/
|
|
4570
|
+
_compute() {
|
|
4415
4571
|
let vertex;
|
|
4416
|
-
this.
|
|
4417
|
-
while ((vertex = this.
|
|
4418
|
-
this.
|
|
4572
|
+
this._computeInitialHull();
|
|
4573
|
+
while ((vertex = this._nextVertexToAdd()) !== void 0) {
|
|
4574
|
+
this._addVertexToHull(vertex);
|
|
4419
4575
|
}
|
|
4420
|
-
this.
|
|
4421
|
-
this.
|
|
4576
|
+
this._reindexFaces();
|
|
4577
|
+
this._cleanup();
|
|
4422
4578
|
return this;
|
|
4423
4579
|
}
|
|
4424
4580
|
}
|
|
4425
4581
|
class Face {
|
|
4582
|
+
/**
|
|
4583
|
+
* Constructs a new face.
|
|
4584
|
+
*/
|
|
4426
4585
|
constructor() {
|
|
4427
4586
|
this.normal = new THREE$1.Vector3();
|
|
4428
4587
|
this.midpoint = new THREE$1.Vector3();
|
|
@@ -4432,6 +4591,15 @@ class Face {
|
|
|
4432
4591
|
this.mark = Visible;
|
|
4433
4592
|
this.edge = null;
|
|
4434
4593
|
}
|
|
4594
|
+
/**
|
|
4595
|
+
* Creates a face from the given vertex nodes.
|
|
4596
|
+
*
|
|
4597
|
+
* @private
|
|
4598
|
+
* @param {VertexNode} a - The first vertex node.
|
|
4599
|
+
* @param {VertexNode} b - The second vertex node.
|
|
4600
|
+
* @param {VertexNode} c - The third vertex node.
|
|
4601
|
+
* @return {Face} The created face.
|
|
4602
|
+
*/
|
|
4435
4603
|
static create(a, b, c) {
|
|
4436
4604
|
const face = new Face();
|
|
4437
4605
|
const e0 = new HalfEdge(a, face);
|
|
@@ -4443,6 +4611,13 @@ class Face {
|
|
|
4443
4611
|
face.edge = e0;
|
|
4444
4612
|
return face.compute();
|
|
4445
4613
|
}
|
|
4614
|
+
/**
|
|
4615
|
+
* Returns an edge by the given index.
|
|
4616
|
+
*
|
|
4617
|
+
* @private
|
|
4618
|
+
* @param {number} i - The edge index.
|
|
4619
|
+
* @return {HalfEdge} The edge.
|
|
4620
|
+
*/
|
|
4446
4621
|
getEdge(i) {
|
|
4447
4622
|
let edge = this.edge;
|
|
4448
4623
|
while (i > 0) {
|
|
@@ -4455,6 +4630,12 @@ class Face {
|
|
|
4455
4630
|
}
|
|
4456
4631
|
return edge;
|
|
4457
4632
|
}
|
|
4633
|
+
/**
|
|
4634
|
+
* Computes all properties of the face.
|
|
4635
|
+
*
|
|
4636
|
+
* @private
|
|
4637
|
+
* @return {Face} A reference to this face.
|
|
4638
|
+
*/
|
|
4458
4639
|
compute() {
|
|
4459
4640
|
const a = this.edge.tail();
|
|
4460
4641
|
const b = this.edge.head();
|
|
@@ -4466,11 +4647,24 @@ class Face {
|
|
|
4466
4647
|
this.constant = this.normal.dot(this.midpoint);
|
|
4467
4648
|
return this;
|
|
4468
4649
|
}
|
|
4650
|
+
/**
|
|
4651
|
+
* Returns the signed distance from a given point to the plane representation of this face.
|
|
4652
|
+
*
|
|
4653
|
+
* @private
|
|
4654
|
+
* @param {Vector3} point - The point to compute the distance to.
|
|
4655
|
+
* @return {number} The distance.
|
|
4656
|
+
*/
|
|
4469
4657
|
distanceToPoint(point) {
|
|
4470
4658
|
return this.normal.dot(point) - this.constant;
|
|
4471
4659
|
}
|
|
4472
4660
|
}
|
|
4473
4661
|
class HalfEdge {
|
|
4662
|
+
/**
|
|
4663
|
+
* Constructs a new half edge.
|
|
4664
|
+
*
|
|
4665
|
+
* @param {VertexNode} vertex - A reference to its destination vertex.
|
|
4666
|
+
* @param {Face} face - A reference to its face.
|
|
4667
|
+
*/
|
|
4474
4668
|
constructor(vertex, face) {
|
|
4475
4669
|
this.vertex = vertex;
|
|
4476
4670
|
this.prev = null;
|
|
@@ -4478,12 +4672,30 @@ class HalfEdge {
|
|
|
4478
4672
|
this.twin = null;
|
|
4479
4673
|
this.face = face;
|
|
4480
4674
|
}
|
|
4675
|
+
/**
|
|
4676
|
+
* Returns the destination vertex.
|
|
4677
|
+
*
|
|
4678
|
+
* @private
|
|
4679
|
+
* @return {VertexNode} The destination vertex.
|
|
4680
|
+
*/
|
|
4481
4681
|
head() {
|
|
4482
4682
|
return this.vertex;
|
|
4483
4683
|
}
|
|
4684
|
+
/**
|
|
4685
|
+
* Returns the origin vertex.
|
|
4686
|
+
*
|
|
4687
|
+
* @private
|
|
4688
|
+
* @return {VertexNode} The destination vertex.
|
|
4689
|
+
*/
|
|
4484
4690
|
tail() {
|
|
4485
4691
|
return this.prev ? this.prev.vertex : null;
|
|
4486
4692
|
}
|
|
4693
|
+
/**
|
|
4694
|
+
* Returns the Euclidean length (straight-line length) of the edge.
|
|
4695
|
+
*
|
|
4696
|
+
* @private
|
|
4697
|
+
* @return {number} The edge's length.
|
|
4698
|
+
*/
|
|
4487
4699
|
length() {
|
|
4488
4700
|
const head = this.head();
|
|
4489
4701
|
const tail = this.tail();
|
|
@@ -4492,6 +4704,12 @@ class HalfEdge {
|
|
|
4492
4704
|
}
|
|
4493
4705
|
return -1;
|
|
4494
4706
|
}
|
|
4707
|
+
/**
|
|
4708
|
+
* Returns the square of the Euclidean length (straight-line length) of the edge.
|
|
4709
|
+
*
|
|
4710
|
+
* @private
|
|
4711
|
+
* @return {number} The square of the edge's length.
|
|
4712
|
+
*/
|
|
4495
4713
|
lengthSquared() {
|
|
4496
4714
|
const head = this.head();
|
|
4497
4715
|
const tail = this.tail();
|
|
@@ -4500,6 +4718,14 @@ class HalfEdge {
|
|
|
4500
4718
|
}
|
|
4501
4719
|
return -1;
|
|
4502
4720
|
}
|
|
4721
|
+
/**
|
|
4722
|
+
* Sets the twin edge of this half-edge. It also ensures that the twin reference
|
|
4723
|
+
* of the given half-edge is correctly set.
|
|
4724
|
+
*
|
|
4725
|
+
* @private
|
|
4726
|
+
* @param {HalfEdge} edge - The twin edge to set.
|
|
4727
|
+
* @return {HalfEdge} A reference to this edge.
|
|
4728
|
+
*/
|
|
4503
4729
|
setTwin(edge) {
|
|
4504
4730
|
this.twin = edge;
|
|
4505
4731
|
edge.twin = this;
|
|
@@ -4507,6 +4733,11 @@ class HalfEdge {
|
|
|
4507
4733
|
}
|
|
4508
4734
|
}
|
|
4509
4735
|
class VertexNode {
|
|
4736
|
+
/**
|
|
4737
|
+
* Constructs a new vertex node.
|
|
4738
|
+
*
|
|
4739
|
+
* @param {Vector3} point - A point in 3D space.
|
|
4740
|
+
*/
|
|
4510
4741
|
constructor(point) {
|
|
4511
4742
|
this.point = point;
|
|
4512
4743
|
this.prev = null;
|
|
@@ -4515,21 +4746,49 @@ class VertexNode {
|
|
|
4515
4746
|
}
|
|
4516
4747
|
}
|
|
4517
4748
|
class VertexList {
|
|
4749
|
+
/**
|
|
4750
|
+
* Constructs a new vertex list.
|
|
4751
|
+
*/
|
|
4518
4752
|
constructor() {
|
|
4519
4753
|
this.head = null;
|
|
4520
4754
|
this.tail = null;
|
|
4521
4755
|
}
|
|
4756
|
+
/**
|
|
4757
|
+
* Returns the head reference.
|
|
4758
|
+
*
|
|
4759
|
+
* @private
|
|
4760
|
+
* @return {VertexNode} The head reference.
|
|
4761
|
+
*/
|
|
4522
4762
|
first() {
|
|
4523
4763
|
return this.head;
|
|
4524
4764
|
}
|
|
4765
|
+
/**
|
|
4766
|
+
* Returns the tail reference.
|
|
4767
|
+
*
|
|
4768
|
+
* @private
|
|
4769
|
+
* @return {VertexNode} The tail reference.
|
|
4770
|
+
*/
|
|
4525
4771
|
last() {
|
|
4526
4772
|
return this.tail;
|
|
4527
4773
|
}
|
|
4774
|
+
/**
|
|
4775
|
+
* Clears the linked list.
|
|
4776
|
+
*
|
|
4777
|
+
* @private
|
|
4778
|
+
* @return {VertexList} A reference to this vertex list.
|
|
4779
|
+
*/
|
|
4528
4780
|
clear() {
|
|
4529
4781
|
this.head = this.tail = null;
|
|
4530
4782
|
return this;
|
|
4531
4783
|
}
|
|
4532
|
-
|
|
4784
|
+
/**
|
|
4785
|
+
* Inserts a vertex before a target vertex.
|
|
4786
|
+
*
|
|
4787
|
+
* @private
|
|
4788
|
+
* @param {VertexNode} target - The target.
|
|
4789
|
+
* @param {VertexNode} vertex - The vertex to insert.
|
|
4790
|
+
* @return {VertexList} A reference to this vertex list.
|
|
4791
|
+
*/
|
|
4533
4792
|
insertBefore(target, vertex) {
|
|
4534
4793
|
vertex.prev = target.prev;
|
|
4535
4794
|
vertex.next = target;
|
|
@@ -4541,7 +4800,14 @@ class VertexList {
|
|
|
4541
4800
|
target.prev = vertex;
|
|
4542
4801
|
return this;
|
|
4543
4802
|
}
|
|
4544
|
-
|
|
4803
|
+
/**
|
|
4804
|
+
* Inserts a vertex after a target vertex.
|
|
4805
|
+
*
|
|
4806
|
+
* @private
|
|
4807
|
+
* @param {VertexNode} target - The target.
|
|
4808
|
+
* @param {VertexNode} vertex - The vertex to insert.
|
|
4809
|
+
* @return {VertexList} A reference to this vertex list.
|
|
4810
|
+
*/
|
|
4545
4811
|
insertAfter(target, vertex) {
|
|
4546
4812
|
vertex.prev = target;
|
|
4547
4813
|
vertex.next = target.next;
|
|
@@ -4553,7 +4819,13 @@ class VertexList {
|
|
|
4553
4819
|
target.next = vertex;
|
|
4554
4820
|
return this;
|
|
4555
4821
|
}
|
|
4556
|
-
|
|
4822
|
+
/**
|
|
4823
|
+
* Appends a vertex to this vertex list.
|
|
4824
|
+
*
|
|
4825
|
+
* @private
|
|
4826
|
+
* @param {VertexNode} vertex - The vertex to append.
|
|
4827
|
+
* @return {VertexList} A reference to this vertex list.
|
|
4828
|
+
*/
|
|
4557
4829
|
append(vertex) {
|
|
4558
4830
|
if (this.head === null) {
|
|
4559
4831
|
this.head = vertex;
|
|
@@ -4565,7 +4837,13 @@ class VertexList {
|
|
|
4565
4837
|
this.tail = vertex;
|
|
4566
4838
|
return this;
|
|
4567
4839
|
}
|
|
4568
|
-
|
|
4840
|
+
/**
|
|
4841
|
+
* Appends a chain of vertices where the given vertex is the head.
|
|
4842
|
+
*
|
|
4843
|
+
* @private
|
|
4844
|
+
* @param {VertexNode} vertex - The head vertex of a chain of vertices.
|
|
4845
|
+
* @return {VertexList} A reference to this vertex list.
|
|
4846
|
+
*/
|
|
4569
4847
|
appendChain(vertex) {
|
|
4570
4848
|
if (this.head === null) {
|
|
4571
4849
|
this.head = vertex;
|
|
@@ -4579,7 +4857,13 @@ class VertexList {
|
|
|
4579
4857
|
this.tail = vertex;
|
|
4580
4858
|
return this;
|
|
4581
4859
|
}
|
|
4582
|
-
|
|
4860
|
+
/**
|
|
4861
|
+
* Removes a vertex from the linked list.
|
|
4862
|
+
*
|
|
4863
|
+
* @private
|
|
4864
|
+
* @param {VertexNode} vertex - The vertex to remove.
|
|
4865
|
+
* @return {VertexList} A reference to this vertex list.
|
|
4866
|
+
*/
|
|
4583
4867
|
remove(vertex) {
|
|
4584
4868
|
if (vertex.prev === null) {
|
|
4585
4869
|
this.head = vertex.next;
|
|
@@ -4593,7 +4877,14 @@ class VertexList {
|
|
|
4593
4877
|
}
|
|
4594
4878
|
return this;
|
|
4595
4879
|
}
|
|
4596
|
-
|
|
4880
|
+
/**
|
|
4881
|
+
* Removes a sublist of vertices from the linked list.
|
|
4882
|
+
*
|
|
4883
|
+
* @private
|
|
4884
|
+
* @param {VertexNode} a - The head of the sublist.
|
|
4885
|
+
* @param {VertexNode} b - The tail of the sublist.
|
|
4886
|
+
* @return {VertexList} A reference to this vertex list.
|
|
4887
|
+
*/
|
|
4597
4888
|
removeSubList(a, b) {
|
|
4598
4889
|
if (a.prev === null) {
|
|
4599
4890
|
this.head = b.next;
|
|
@@ -4607,6 +4898,12 @@ class VertexList {
|
|
|
4607
4898
|
}
|
|
4608
4899
|
return this;
|
|
4609
4900
|
}
|
|
4901
|
+
/**
|
|
4902
|
+
* Returns `true` if the linked list is empty.
|
|
4903
|
+
*
|
|
4904
|
+
* @private
|
|
4905
|
+
* @return {boolean} Whether the linked list is empty or not.
|
|
4906
|
+
*/
|
|
4610
4907
|
isEmpty() {
|
|
4611
4908
|
return this.head === null;
|
|
4612
4909
|
}
|
|
@@ -6312,7 +6609,7 @@ const _Components = class _Components {
|
|
|
6312
6609
|
/**
|
|
6313
6610
|
* The version of the @thatopen/components library.
|
|
6314
6611
|
*/
|
|
6315
|
-
__publicField(_Components, "release", "2.4.
|
|
6612
|
+
__publicField(_Components, "release", "2.4.10");
|
|
6316
6613
|
let Components = _Components;
|
|
6317
6614
|
class SimpleWorld extends Base {
|
|
6318
6615
|
constructor() {
|
|
@@ -6882,20 +7179,24 @@ const ACTION = Object.freeze({
|
|
|
6882
7179
|
NONE: 0,
|
|
6883
7180
|
ROTATE: 1,
|
|
6884
7181
|
TRUCK: 2,
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
7182
|
+
SCREEN_PAN: 4,
|
|
7183
|
+
OFFSET: 8,
|
|
7184
|
+
DOLLY: 16,
|
|
7185
|
+
ZOOM: 32,
|
|
7186
|
+
TOUCH_ROTATE: 64,
|
|
7187
|
+
TOUCH_TRUCK: 128,
|
|
7188
|
+
TOUCH_SCREEN_PAN: 256,
|
|
7189
|
+
TOUCH_OFFSET: 512,
|
|
7190
|
+
TOUCH_DOLLY: 1024,
|
|
7191
|
+
TOUCH_ZOOM: 2048,
|
|
7192
|
+
TOUCH_DOLLY_TRUCK: 4096,
|
|
7193
|
+
TOUCH_DOLLY_SCREEN_PAN: 8192,
|
|
7194
|
+
TOUCH_DOLLY_OFFSET: 16384,
|
|
7195
|
+
TOUCH_DOLLY_ROTATE: 32768,
|
|
7196
|
+
TOUCH_ZOOM_TRUCK: 65536,
|
|
7197
|
+
TOUCH_ZOOM_OFFSET: 131072,
|
|
7198
|
+
TOUCH_ZOOM_SCREEN_PAN: 262144,
|
|
7199
|
+
TOUCH_ZOOM_ROTATE: 524288
|
|
6899
7200
|
});
|
|
6900
7201
|
const DOLLY_DIRECTION = {
|
|
6901
7202
|
NONE: 0,
|
|
@@ -7094,11 +7395,10 @@ class EventDispatcher {
|
|
|
7094
7395
|
}
|
|
7095
7396
|
}
|
|
7096
7397
|
}
|
|
7097
|
-
|
|
7398
|
+
var _a;
|
|
7399
|
+
const VERSION = "2.10.1";
|
|
7098
7400
|
const TOUCH_DOLLY_FACTOR = 1 / 8;
|
|
7099
|
-
const
|
|
7100
|
-
const isMac = isBrowser && /Mac/.test(navigator.platform);
|
|
7101
|
-
const isPointerEventsNotSupported = !(isBrowser && "PointerEvent" in window);
|
|
7401
|
+
const isMac = /Mac/.test((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) === null || _a === void 0 ? void 0 : _a.platform);
|
|
7102
7402
|
let THREE;
|
|
7103
7403
|
let _ORIGIN;
|
|
7104
7404
|
let _AXIS_Y;
|
|
@@ -7195,6 +7495,12 @@ class CameraControls extends EventDispatcher {
|
|
|
7195
7495
|
static get ACTION() {
|
|
7196
7496
|
return ACTION;
|
|
7197
7497
|
}
|
|
7498
|
+
/**
|
|
7499
|
+
* @deprecated Use `cameraControls.mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.
|
|
7500
|
+
*/
|
|
7501
|
+
set verticalDragToForward(_) {
|
|
7502
|
+
console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.");
|
|
7503
|
+
}
|
|
7198
7504
|
/**
|
|
7199
7505
|
* Creates a `CameraControls` instance.
|
|
7200
7506
|
*
|
|
@@ -7233,7 +7539,6 @@ class CameraControls extends EventDispatcher {
|
|
|
7233
7539
|
this.truckSpeed = 2;
|
|
7234
7540
|
this.dollyToCursor = false;
|
|
7235
7541
|
this.dragToOffset = false;
|
|
7236
|
-
this.verticalDragToForward = false;
|
|
7237
7542
|
this.boundaryFriction = 0;
|
|
7238
7543
|
this.restThreshold = 0.01;
|
|
7239
7544
|
this.colliderMeshes = [];
|
|
@@ -7266,7 +7571,7 @@ class CameraControls extends EventDispatcher {
|
|
|
7266
7571
|
this._targetVelocity = new THREE.Vector3();
|
|
7267
7572
|
this._focalOffsetVelocity = new THREE.Vector3();
|
|
7268
7573
|
this._zoomVelocity = { value: 0 };
|
|
7269
|
-
this._truckInternal = (deltaX, deltaY, dragToOffset) => {
|
|
7574
|
+
this._truckInternal = (deltaX, deltaY, dragToOffset, screenSpacePanning) => {
|
|
7270
7575
|
let truckX;
|
|
7271
7576
|
let pedestalY;
|
|
7272
7577
|
if (isPerspectiveCamera(this._camera)) {
|
|
@@ -7277,12 +7582,12 @@ class CameraControls extends EventDispatcher {
|
|
|
7277
7582
|
pedestalY = this.truckSpeed * deltaY * targetDistance / this._elementRect.height;
|
|
7278
7583
|
} else if (isOrthographicCamera(this._camera)) {
|
|
7279
7584
|
const camera2 = this._camera;
|
|
7280
|
-
truckX = deltaX * (camera2.right - camera2.left) / camera2.zoom / this._elementRect.width;
|
|
7281
|
-
pedestalY = deltaY * (camera2.top - camera2.bottom) / camera2.zoom / this._elementRect.height;
|
|
7585
|
+
truckX = this.truckSpeed * deltaX * (camera2.right - camera2.left) / camera2.zoom / this._elementRect.width;
|
|
7586
|
+
pedestalY = this.truckSpeed * deltaY * (camera2.top - camera2.bottom) / camera2.zoom / this._elementRect.height;
|
|
7282
7587
|
} else {
|
|
7283
7588
|
return;
|
|
7284
7589
|
}
|
|
7285
|
-
if (
|
|
7590
|
+
if (screenSpacePanning) {
|
|
7286
7591
|
dragToOffset ? this.setFocalOffset(this._focalOffsetEnd.x + truckX, this._focalOffsetEnd.y, this._focalOffsetEnd.z, true) : this.truck(truckX, 0, true);
|
|
7287
7592
|
this.forward(-pedestalY, true);
|
|
7288
7593
|
} else {
|
|
@@ -7402,37 +7707,6 @@ class CameraControls extends EventDispatcher {
|
|
|
7402
7707
|
this._isDragging = true;
|
|
7403
7708
|
startDragging(event);
|
|
7404
7709
|
};
|
|
7405
|
-
const onMouseDown = (event) => {
|
|
7406
|
-
if (!this._enabled || !this._domElement || this._lockedPointer)
|
|
7407
|
-
return;
|
|
7408
|
-
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
7409
|
-
const elRect = this._domElement.getBoundingClientRect();
|
|
7410
|
-
const left = event.clientX / elRect.width;
|
|
7411
|
-
const top = event.clientY / elRect.height;
|
|
7412
|
-
if (left < this._interactiveArea.left || left > this._interactiveArea.right || top < this._interactiveArea.top || top > this._interactiveArea.bottom)
|
|
7413
|
-
return;
|
|
7414
|
-
}
|
|
7415
|
-
const mouseButton = (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.LEFT : (event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE ? MOUSE_BUTTON.MIDDLE : (event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT ? MOUSE_BUTTON.RIGHT : null;
|
|
7416
|
-
if (mouseButton !== null) {
|
|
7417
|
-
const zombiePointer = this._findPointerByMouseButton(mouseButton);
|
|
7418
|
-
zombiePointer && this._disposePointer(zombiePointer);
|
|
7419
|
-
}
|
|
7420
|
-
const pointer = {
|
|
7421
|
-
pointerId: 1,
|
|
7422
|
-
clientX: event.clientX,
|
|
7423
|
-
clientY: event.clientY,
|
|
7424
|
-
deltaX: 0,
|
|
7425
|
-
deltaY: 0,
|
|
7426
|
-
mouseButton: (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.LEFT : (event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.MIDDLE : (event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.RIGHT : null
|
|
7427
|
-
};
|
|
7428
|
-
this._activePointers.push(pointer);
|
|
7429
|
-
this._domElement.ownerDocument.removeEventListener("mousemove", onMouseMove);
|
|
7430
|
-
this._domElement.ownerDocument.removeEventListener("mouseup", onMouseUp);
|
|
7431
|
-
this._domElement.ownerDocument.addEventListener("mousemove", onMouseMove);
|
|
7432
|
-
this._domElement.ownerDocument.addEventListener("mouseup", onMouseUp);
|
|
7433
|
-
this._isDragging = true;
|
|
7434
|
-
startDragging(event);
|
|
7435
|
-
};
|
|
7436
7710
|
const onPointerMove2 = (event) => {
|
|
7437
7711
|
if (event.cancelable)
|
|
7438
7712
|
event.preventDefault();
|
|
@@ -7470,26 +7744,6 @@ class CameraControls extends EventDispatcher {
|
|
|
7470
7744
|
}
|
|
7471
7745
|
dragging();
|
|
7472
7746
|
};
|
|
7473
|
-
const onMouseMove = (event) => {
|
|
7474
|
-
const pointer = this._lockedPointer || this._findPointerById(1);
|
|
7475
|
-
if (!pointer)
|
|
7476
|
-
return;
|
|
7477
|
-
pointer.clientX = event.clientX;
|
|
7478
|
-
pointer.clientY = event.clientY;
|
|
7479
|
-
pointer.deltaX = event.movementX;
|
|
7480
|
-
pointer.deltaY = event.movementY;
|
|
7481
|
-
this._state = 0;
|
|
7482
|
-
if (this._lockedPointer || (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT) {
|
|
7483
|
-
this._state = this._state | this.mouseButtons.left;
|
|
7484
|
-
}
|
|
7485
|
-
if ((event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE) {
|
|
7486
|
-
this._state = this._state | this.mouseButtons.middle;
|
|
7487
|
-
}
|
|
7488
|
-
if ((event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT) {
|
|
7489
|
-
this._state = this._state | this.mouseButtons.right;
|
|
7490
|
-
}
|
|
7491
|
-
dragging();
|
|
7492
|
-
};
|
|
7493
7747
|
const onPointerUp2 = (event) => {
|
|
7494
7748
|
const pointer = this._findPointerById(event.pointerId);
|
|
7495
7749
|
if (pointer && pointer === this._lockedPointer)
|
|
@@ -7515,14 +7769,6 @@ class CameraControls extends EventDispatcher {
|
|
|
7515
7769
|
}
|
|
7516
7770
|
endDragging();
|
|
7517
7771
|
};
|
|
7518
|
-
const onMouseUp = () => {
|
|
7519
|
-
const pointer = this._findPointerById(1);
|
|
7520
|
-
if (pointer && pointer === this._lockedPointer)
|
|
7521
|
-
return;
|
|
7522
|
-
pointer && this._disposePointer(pointer);
|
|
7523
|
-
this._state = ACTION.NONE;
|
|
7524
|
-
endDragging();
|
|
7525
|
-
};
|
|
7526
7772
|
let lastScrollTimeStamp = -1;
|
|
7527
7773
|
const onMouseWheel = (event) => {
|
|
7528
7774
|
if (!this._domElement)
|
|
@@ -7544,7 +7790,7 @@ class CameraControls extends EventDispatcher {
|
|
|
7544
7790
|
lastScrollTimeStamp = now;
|
|
7545
7791
|
}
|
|
7546
7792
|
const deltaYFactor = isMac ? -1 : -3;
|
|
7547
|
-
const delta = event.deltaMode === 1 ? event.deltaY / deltaYFactor : event.deltaY / (deltaYFactor * 10);
|
|
7793
|
+
const delta = event.deltaMode === 1 || event.ctrlKey ? event.deltaY / deltaYFactor : event.deltaY / (deltaYFactor * 10);
|
|
7548
7794
|
const x = this.dollyToCursor ? (event.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0;
|
|
7549
7795
|
const y = this.dollyToCursor ? (event.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
7550
7796
|
switch (this.mouseButtons.wheel) {
|
|
@@ -7554,12 +7800,17 @@ class CameraControls extends EventDispatcher {
|
|
|
7554
7800
|
break;
|
|
7555
7801
|
}
|
|
7556
7802
|
case ACTION.TRUCK: {
|
|
7557
|
-
this._truckInternal(event.deltaX, event.deltaY, false);
|
|
7803
|
+
this._truckInternal(event.deltaX, event.deltaY, false, false);
|
|
7804
|
+
this._isUserControllingTruck = true;
|
|
7805
|
+
break;
|
|
7806
|
+
}
|
|
7807
|
+
case ACTION.SCREEN_PAN: {
|
|
7808
|
+
this._truckInternal(event.deltaX, event.deltaY, false, true);
|
|
7558
7809
|
this._isUserControllingTruck = true;
|
|
7559
7810
|
break;
|
|
7560
7811
|
}
|
|
7561
7812
|
case ACTION.OFFSET: {
|
|
7562
|
-
this._truckInternal(event.deltaX, event.deltaY, true);
|
|
7813
|
+
this._truckInternal(event.deltaX, event.deltaY, true, false);
|
|
7563
7814
|
this._isUserControllingOffset = true;
|
|
7564
7815
|
break;
|
|
7565
7816
|
}
|
|
@@ -7580,13 +7831,11 @@ class CameraControls extends EventDispatcher {
|
|
|
7580
7831
|
if (!this._domElement || !this._enabled)
|
|
7581
7832
|
return;
|
|
7582
7833
|
if (this.mouseButtons.right === CameraControls.ACTION.NONE) {
|
|
7583
|
-
const pointerId = event instanceof PointerEvent ? event.pointerId :
|
|
7834
|
+
const pointerId = event instanceof PointerEvent ? event.pointerId : 0;
|
|
7584
7835
|
const pointer = this._findPointerById(pointerId);
|
|
7585
7836
|
pointer && this._disposePointer(pointer);
|
|
7586
7837
|
this._domElement.ownerDocument.removeEventListener("pointermove", onPointerMove2, { passive: false });
|
|
7587
7838
|
this._domElement.ownerDocument.removeEventListener("pointerup", onPointerUp2);
|
|
7588
|
-
this._domElement.ownerDocument.removeEventListener("mousemove", onMouseMove);
|
|
7589
|
-
this._domElement.ownerDocument.removeEventListener("mouseup", onMouseUp);
|
|
7590
7839
|
return;
|
|
7591
7840
|
}
|
|
7592
7841
|
event.preventDefault();
|
|
@@ -7641,15 +7890,15 @@ class CameraControls extends EventDispatcher {
|
|
|
7641
7890
|
this._thetaVelocity.value = 0;
|
|
7642
7891
|
this._phiVelocity.value = 0;
|
|
7643
7892
|
}
|
|
7644
|
-
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) {
|
|
7893
|
+
if ((this._state & ACTION.TRUCK) === ACTION.TRUCK || (this._state & ACTION.SCREEN_PAN) === ACTION.SCREEN_PAN || (this._state & ACTION.TOUCH_TRUCK) === ACTION.TOUCH_TRUCK || (this._state & ACTION.TOUCH_SCREEN_PAN) === ACTION.TOUCH_SCREEN_PAN || (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (this._state & ACTION.TOUCH_DOLLY_SCREEN_PAN) === ACTION.TOUCH_DOLLY_SCREEN_PAN || (this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK || (this._state & ACTION.TOUCH_ZOOM_SCREEN_PAN) === ACTION.TOUCH_DOLLY_SCREEN_PAN) {
|
|
7645
7894
|
this._targetEnd.copy(this._target);
|
|
7646
7895
|
this._targetVelocity.set(0, 0, 0);
|
|
7647
7896
|
}
|
|
7648
|
-
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) {
|
|
7897
|
+
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_SCREEN_PAN) === ACTION.TOUCH_DOLLY_SCREEN_PAN || (this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET || (this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE) {
|
|
7649
7898
|
this._sphericalEnd.radius = this._spherical.radius;
|
|
7650
7899
|
this._radiusVelocity.value = 0;
|
|
7651
7900
|
}
|
|
7652
|
-
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) {
|
|
7901
|
+
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_SCREEN_PAN) === ACTION.TOUCH_ZOOM_SCREEN_PAN || (this._state & ACTION.TOUCH_ZOOM_OFFSET) === ACTION.TOUCH_ZOOM_OFFSET || (this._state & ACTION.TOUCH_ZOOM_ROTATE) === ACTION.TOUCH_ZOOM_ROTATE) {
|
|
7653
7902
|
this._zoomEnd = this._zoom;
|
|
7654
7903
|
this._zoomVelocity.value = 0;
|
|
7655
7904
|
}
|
|
@@ -7664,7 +7913,7 @@ class CameraControls extends EventDispatcher {
|
|
|
7664
7913
|
return;
|
|
7665
7914
|
this._dragNeedsUpdate = false;
|
|
7666
7915
|
extractClientCoordFromEvent(this._activePointers, _v2$1);
|
|
7667
|
-
const isPointerLockActive = this._domElement &&
|
|
7916
|
+
const isPointerLockActive = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement;
|
|
7668
7917
|
const lockedPointer = isPointerLockActive ? this._lockedPointer || this._activePointers[0] : null;
|
|
7669
7918
|
const deltaX = lockedPointer ? -lockedPointer.deltaX : lastDragPosition.x - _v2$1.x;
|
|
7670
7919
|
const deltaY = lockedPointer ? -lockedPointer.deltaY : lastDragPosition.y - _v2$1.y;
|
|
@@ -7685,7 +7934,7 @@ class CameraControls extends EventDispatcher {
|
|
|
7685
7934
|
this._isUserControllingZoom = true;
|
|
7686
7935
|
}
|
|
7687
7936
|
}
|
|
7688
|
-
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) {
|
|
7937
|
+
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_SCREEN_PAN) === ACTION.TOUCH_DOLLY_SCREEN_PAN || (this._state & ACTION.TOUCH_ZOOM_SCREEN_PAN) === ACTION.TOUCH_ZOOM_SCREEN_PAN || (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) {
|
|
7689
7938
|
const dx = _v2$1.x - this._activePointers[1].clientX;
|
|
7690
7939
|
const dy = _v2$1.y - this._activePointers[1].clientY;
|
|
7691
7940
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
@@ -7693,7 +7942,7 @@ class CameraControls extends EventDispatcher {
|
|
|
7693
7942
|
dollyStart.set(0, distance);
|
|
7694
7943
|
const dollyX = this.dollyToCursor ? (lastDragPosition.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0;
|
|
7695
7944
|
const dollyY = this.dollyToCursor ? (lastDragPosition.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
7696
|
-
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) {
|
|
7945
|
+
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_SCREEN_PAN) === ACTION.TOUCH_DOLLY_SCREEN_PAN || (this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET) {
|
|
7697
7946
|
this._dollyInternal(dollyDelta * TOUCH_DOLLY_FACTOR, dollyX, dollyY);
|
|
7698
7947
|
this._isUserControllingDolly = true;
|
|
7699
7948
|
} else {
|
|
@@ -7702,11 +7951,15 @@ class CameraControls extends EventDispatcher {
|
|
|
7702
7951
|
}
|
|
7703
7952
|
}
|
|
7704
7953
|
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) {
|
|
7705
|
-
this._truckInternal(deltaX, deltaY, false);
|
|
7954
|
+
this._truckInternal(deltaX, deltaY, false, false);
|
|
7955
|
+
this._isUserControllingTruck = true;
|
|
7956
|
+
}
|
|
7957
|
+
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) {
|
|
7958
|
+
this._truckInternal(deltaX, deltaY, false, true);
|
|
7706
7959
|
this._isUserControllingTruck = true;
|
|
7707
7960
|
}
|
|
7708
7961
|
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) {
|
|
7709
|
-
this._truckInternal(deltaX, deltaY, true);
|
|
7962
|
+
this._truckInternal(deltaX, deltaY, true, false);
|
|
7710
7963
|
this._isUserControllingOffset = true;
|
|
7711
7964
|
}
|
|
7712
7965
|
this.dispatchEvent({ type: "control" });
|
|
@@ -7720,9 +7973,7 @@ class CameraControls extends EventDispatcher {
|
|
|
7720
7973
|
}
|
|
7721
7974
|
if (this._activePointers.length === 0 && this._domElement) {
|
|
7722
7975
|
this._domElement.ownerDocument.removeEventListener("pointermove", onPointerMove2, { passive: false });
|
|
7723
|
-
this._domElement.ownerDocument.removeEventListener("mousemove", onMouseMove);
|
|
7724
7976
|
this._domElement.ownerDocument.removeEventListener("pointerup", onPointerUp2);
|
|
7725
|
-
this._domElement.ownerDocument.removeEventListener("mouseup", onMouseUp);
|
|
7726
7977
|
this.dispatchEvent({ type: "controlend" });
|
|
7727
7978
|
}
|
|
7728
7979
|
};
|
|
@@ -7749,16 +8000,15 @@ class CameraControls extends EventDispatcher {
|
|
|
7749
8000
|
startDragging();
|
|
7750
8001
|
};
|
|
7751
8002
|
this.unlockPointer = () => {
|
|
8003
|
+
var _a2, _b, _c;
|
|
7752
8004
|
if (this._lockedPointer !== null) {
|
|
7753
8005
|
this._disposePointer(this._lockedPointer);
|
|
7754
8006
|
this._lockedPointer = null;
|
|
7755
8007
|
}
|
|
7756
|
-
|
|
8008
|
+
(_a2 = this._domElement) === null || _a2 === void 0 ? void 0 : _a2.ownerDocument.exitPointerLock();
|
|
8009
|
+
(_b = this._domElement) === null || _b === void 0 ? void 0 : _b.ownerDocument.removeEventListener("pointerlockchange", onPointerLockChange);
|
|
8010
|
+
(_c = this._domElement) === null || _c === void 0 ? void 0 : _c.ownerDocument.removeEventListener("pointerlockerror", onPointerLockError);
|
|
7757
8011
|
this.cancel();
|
|
7758
|
-
if (!this._domElement)
|
|
7759
|
-
return;
|
|
7760
|
-
this._domElement.ownerDocument.removeEventListener("pointerlockchange", onPointerLockChange);
|
|
7761
|
-
this._domElement.ownerDocument.removeEventListener("pointerlockerror", onPointerLockError);
|
|
7762
8012
|
};
|
|
7763
8013
|
const onPointerLockChange = () => {
|
|
7764
8014
|
const isPointerLockActive = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement;
|
|
@@ -7774,7 +8024,6 @@ class CameraControls extends EventDispatcher {
|
|
|
7774
8024
|
this._domElement.style.userSelect = "none";
|
|
7775
8025
|
this._domElement.style.webkitUserSelect = "none";
|
|
7776
8026
|
this._domElement.addEventListener("pointerdown", onPointerDown2);
|
|
7777
|
-
isPointerEventsNotSupported && this._domElement.addEventListener("mousedown", onMouseDown);
|
|
7778
8027
|
this._domElement.addEventListener("pointercancel", onPointerUp2);
|
|
7779
8028
|
this._domElement.addEventListener("wheel", onMouseWheel, { passive: false });
|
|
7780
8029
|
this._domElement.addEventListener("contextmenu", onContextMenu);
|
|
@@ -7786,14 +8035,11 @@ class CameraControls extends EventDispatcher {
|
|
|
7786
8035
|
this._domElement.style.userSelect = "";
|
|
7787
8036
|
this._domElement.style.webkitUserSelect = "";
|
|
7788
8037
|
this._domElement.removeEventListener("pointerdown", onPointerDown2);
|
|
7789
|
-
this._domElement.removeEventListener("mousedown", onMouseDown);
|
|
7790
8038
|
this._domElement.removeEventListener("pointercancel", onPointerUp2);
|
|
7791
8039
|
this._domElement.removeEventListener("wheel", onMouseWheel, { passive: false });
|
|
7792
8040
|
this._domElement.removeEventListener("contextmenu", onContextMenu);
|
|
7793
8041
|
this._domElement.ownerDocument.removeEventListener("pointermove", onPointerMove2, { passive: false });
|
|
7794
|
-
this._domElement.ownerDocument.removeEventListener("mousemove", onMouseMove);
|
|
7795
8042
|
this._domElement.ownerDocument.removeEventListener("pointerup", onPointerUp2);
|
|
7796
|
-
this._domElement.ownerDocument.removeEventListener("mouseup", onMouseUp);
|
|
7797
8043
|
this._domElement.ownerDocument.removeEventListener("pointerlockchange", onPointerLockChange);
|
|
7798
8044
|
this._domElement.ownerDocument.removeEventListener("pointerlockerror", onPointerLockError);
|
|
7799
8045
|
};
|
|
@@ -8225,7 +8471,7 @@ class CameraControls extends EventDispatcher {
|
|
|
8225
8471
|
lookInDirectionOf(x, y, z, enableTransition = false) {
|
|
8226
8472
|
const point = _v3A.set(x, y, z);
|
|
8227
8473
|
const direction = point.sub(this._targetEnd).normalize();
|
|
8228
|
-
const position = direction.multiplyScalar(-this._sphericalEnd.radius);
|
|
8474
|
+
const position = direction.multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
|
|
8229
8475
|
return this.setPosition(position.x, position.y, position.z, enableTransition);
|
|
8230
8476
|
}
|
|
8231
8477
|
/**
|
|
@@ -8310,8 +8556,8 @@ class CameraControls extends EventDispatcher {
|
|
|
8310
8556
|
*/
|
|
8311
8557
|
fitToSphere(sphereOrMesh, enableTransition) {
|
|
8312
8558
|
const promises = [];
|
|
8313
|
-
const
|
|
8314
|
-
const boundingSphere =
|
|
8559
|
+
const isObject3D = "isObject3D" in sphereOrMesh;
|
|
8560
|
+
const boundingSphere = isObject3D ? CameraControls.createBoundingSphere(sphereOrMesh, _sphere) : _sphere.copy(sphereOrMesh);
|
|
8315
8561
|
promises.push(this.moveTo(boundingSphere.center.x, boundingSphere.center.y, boundingSphere.center.z, enableTransition));
|
|
8316
8562
|
if (isPerspectiveCamera(this._camera)) {
|
|
8317
8563
|
const distanceToFit = this.getDistanceToFitSphere(boundingSphere.radius);
|
|
@@ -8564,7 +8810,7 @@ class CameraControls extends EventDispatcher {
|
|
|
8564
8810
|
* @category Methods
|
|
8565
8811
|
*/
|
|
8566
8812
|
getSpherical(out, receiveEndValue = true) {
|
|
8567
|
-
const _out =
|
|
8813
|
+
const _out = out || new THREE.Spherical();
|
|
8568
8814
|
return _out.copy(receiveEndValue ? this._sphericalEnd : this._spherical);
|
|
8569
8815
|
}
|
|
8570
8816
|
/**
|
|
@@ -8587,6 +8833,15 @@ class CameraControls extends EventDispatcher {
|
|
|
8587
8833
|
this._sphericalEnd.theta += PI_2;
|
|
8588
8834
|
this._spherical.theta += PI_2 * Math.round((this._sphericalEnd.theta - this._spherical.theta) / PI_2);
|
|
8589
8835
|
}
|
|
8836
|
+
/**
|
|
8837
|
+
* stop all transitions.
|
|
8838
|
+
*/
|
|
8839
|
+
stop() {
|
|
8840
|
+
this._focalOffset.copy(this._focalOffsetEnd);
|
|
8841
|
+
this._target.copy(this._targetEnd);
|
|
8842
|
+
this._spherical.copy(this._sphericalEnd);
|
|
8843
|
+
this._zoom = this._zoomEnd;
|
|
8844
|
+
}
|
|
8590
8845
|
/**
|
|
8591
8846
|
* Reset all rotation and position to defaults.
|
|
8592
8847
|
* @param enableTransition
|
|
@@ -8767,7 +9022,6 @@ class CameraControls extends EventDispatcher {
|
|
|
8767
9022
|
this._camera.lookAt(this._target);
|
|
8768
9023
|
const affectOffset = !approxZero(this._focalOffset.x) || !approxZero(this._focalOffset.y) || !approxZero(this._focalOffset.z);
|
|
8769
9024
|
if (affectOffset) {
|
|
8770
|
-
this._camera.updateMatrixWorld();
|
|
8771
9025
|
_xColumn.setFromMatrixColumn(this._camera.matrix, 0);
|
|
8772
9026
|
_yColumn.setFromMatrixColumn(this._camera.matrix, 1);
|
|
8773
9027
|
_zColumn.setFromMatrixColumn(this._camera.matrix, 2);
|
|
@@ -8776,6 +9030,7 @@ class CameraControls extends EventDispatcher {
|
|
|
8776
9030
|
_zColumn.multiplyScalar(this._focalOffset.z);
|
|
8777
9031
|
_v3A.copy(_xColumn).add(_yColumn).add(_zColumn);
|
|
8778
9032
|
this._camera.position.add(_v3A);
|
|
9033
|
+
this._camera.updateMatrixWorld();
|
|
8779
9034
|
}
|
|
8780
9035
|
if (this._boundaryEnclosesCamera) {
|
|
8781
9036
|
this._encloseToBoundary(this._camera.position.copy(this._target), _v3A.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
|
|
@@ -8820,7 +9075,6 @@ class CameraControls extends EventDispatcher {
|
|
|
8820
9075
|
dollySpeed: this.dollySpeed,
|
|
8821
9076
|
truckSpeed: this.truckSpeed,
|
|
8822
9077
|
dollyToCursor: this.dollyToCursor,
|
|
8823
|
-
verticalDragToForward: this.verticalDragToForward,
|
|
8824
9078
|
target: this._targetEnd.toArray(),
|
|
8825
9079
|
position: _v3A.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
8826
9080
|
zoom: this._zoomEnd,
|
|
@@ -8853,7 +9107,6 @@ class CameraControls extends EventDispatcher {
|
|
|
8853
9107
|
this.dollySpeed = obj.dollySpeed;
|
|
8854
9108
|
this.truckSpeed = obj.truckSpeed;
|
|
8855
9109
|
this.dollyToCursor = obj.dollyToCursor;
|
|
8856
|
-
this.verticalDragToForward = obj.verticalDragToForward;
|
|
8857
9110
|
this._target0.fromArray(obj.target0);
|
|
8858
9111
|
this._position0.fromArray(obj.position0);
|
|
8859
9112
|
this._zoom0 = obj.zoom0;
|
|
@@ -9069,6 +9322,8 @@ class CameraControls extends EventDispatcher {
|
|
|
9069
9322
|
if (!object.isMesh)
|
|
9070
9323
|
return;
|
|
9071
9324
|
const mesh = object;
|
|
9325
|
+
if (!mesh.geometry)
|
|
9326
|
+
return;
|
|
9072
9327
|
const geometry = mesh.geometry.clone();
|
|
9073
9328
|
geometry.applyMatrix4(mesh.matrixWorld);
|
|
9074
9329
|
const bufferGeometry = geometry;
|
|
@@ -9107,14 +9362,14 @@ class SimpleCamera extends BaseCamera {
|
|
|
9107
9362
|
* {@link Components.renderer}.
|
|
9108
9363
|
*/
|
|
9109
9364
|
__publicField(this, "updateAspect", () => {
|
|
9110
|
-
var
|
|
9365
|
+
var _a2;
|
|
9111
9366
|
if (!this.currentWorld || !this.currentWorld.renderer)
|
|
9112
9367
|
return;
|
|
9113
9368
|
if (this.three instanceof THREE__namespace.OrthographicCamera) {
|
|
9114
9369
|
this.onAspectUpdated.trigger();
|
|
9115
9370
|
return;
|
|
9116
9371
|
}
|
|
9117
|
-
if ((
|
|
9372
|
+
if ((_a2 = this.currentWorld.renderer) == null ? void 0 : _a2.isResizeable()) {
|
|
9118
9373
|
const size = this.currentWorld.renderer.getSize();
|
|
9119
9374
|
this.three.aspect = size.width / size.height;
|
|
9120
9375
|
this.three.updateProjectionMatrix();
|
|
@@ -10808,7 +11063,7 @@ class SimpleGrid {
|
|
|
10808
11063
|
|
|
10809
11064
|
`,
|
|
10810
11065
|
extensions: {
|
|
10811
|
-
derivatives: true
|
|
11066
|
+
// derivatives: true,
|
|
10812
11067
|
}
|
|
10813
11068
|
});
|
|
10814
11069
|
this.three = new THREE__namespace.Mesh(geometry, material);
|
|
@@ -10962,26 +11217,26 @@ const _unit = {
|
|
|
10962
11217
|
Z: new THREE$1.Vector3(0, 0, 1)
|
|
10963
11218
|
};
|
|
10964
11219
|
const _changeEvent = { type: "change" };
|
|
10965
|
-
const _mouseDownEvent = { type: "mouseDown" };
|
|
11220
|
+
const _mouseDownEvent = { type: "mouseDown", mode: null };
|
|
10966
11221
|
const _mouseUpEvent = { type: "mouseUp", mode: null };
|
|
10967
11222
|
const _objectChangeEvent = { type: "objectChange" };
|
|
10968
|
-
class TransformControls extends THREE$1.
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
this.
|
|
10979
|
-
const
|
|
10980
|
-
this._gizmo =
|
|
10981
|
-
|
|
10982
|
-
const
|
|
10983
|
-
this._plane =
|
|
10984
|
-
|
|
11223
|
+
class TransformControls extends THREE$1.Controls {
|
|
11224
|
+
/**
|
|
11225
|
+
* Constructs a new controls instance.
|
|
11226
|
+
*
|
|
11227
|
+
* @param {Camera} camera - The camera of the rendered scene.
|
|
11228
|
+
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
11229
|
+
*/
|
|
11230
|
+
constructor(camera, domElement = null) {
|
|
11231
|
+
super(void 0, domElement);
|
|
11232
|
+
const root = new TransformControlsRoot(this);
|
|
11233
|
+
this._root = root;
|
|
11234
|
+
const gizmo = new TransformControlsGizmo();
|
|
11235
|
+
this._gizmo = gizmo;
|
|
11236
|
+
root.add(gizmo);
|
|
11237
|
+
const plane = new TransformControlsPlane();
|
|
11238
|
+
this._plane = plane;
|
|
11239
|
+
root.add(plane);
|
|
10985
11240
|
const scope = this;
|
|
10986
11241
|
function defineProperty(propName2, defaultValue) {
|
|
10987
11242
|
let propValue = defaultValue;
|
|
@@ -10992,16 +11247,16 @@ class TransformControls extends THREE$1.Object3D {
|
|
|
10992
11247
|
set: function(value) {
|
|
10993
11248
|
if (propValue !== value) {
|
|
10994
11249
|
propValue = value;
|
|
10995
|
-
|
|
10996
|
-
|
|
11250
|
+
plane[propName2] = value;
|
|
11251
|
+
gizmo[propName2] = value;
|
|
10997
11252
|
scope.dispatchEvent({ type: propName2 + "-changed", value });
|
|
10998
11253
|
scope.dispatchEvent(_changeEvent);
|
|
10999
11254
|
}
|
|
11000
11255
|
}
|
|
11001
11256
|
});
|
|
11002
11257
|
scope[propName2] = defaultValue;
|
|
11003
|
-
|
|
11004
|
-
|
|
11258
|
+
plane[propName2] = defaultValue;
|
|
11259
|
+
gizmo[propName2] = defaultValue;
|
|
11005
11260
|
}
|
|
11006
11261
|
defineProperty("camera", camera);
|
|
11007
11262
|
defineProperty("object", void 0);
|
|
@@ -11017,6 +11272,12 @@ class TransformControls extends THREE$1.Object3D {
|
|
|
11017
11272
|
defineProperty("showX", true);
|
|
11018
11273
|
defineProperty("showY", true);
|
|
11019
11274
|
defineProperty("showZ", true);
|
|
11275
|
+
defineProperty("minX", -Infinity);
|
|
11276
|
+
defineProperty("maxX", Infinity);
|
|
11277
|
+
defineProperty("minY", -Infinity);
|
|
11278
|
+
defineProperty("maxY", Infinity);
|
|
11279
|
+
defineProperty("minZ", -Infinity);
|
|
11280
|
+
defineProperty("maxZ", Infinity);
|
|
11020
11281
|
const worldPosition = new THREE$1.Vector3();
|
|
11021
11282
|
const worldPositionStart = new THREE$1.Vector3();
|
|
11022
11283
|
const worldQuaternion = new THREE$1.Quaternion();
|
|
@@ -11058,36 +11319,38 @@ class TransformControls extends THREE$1.Object3D {
|
|
|
11058
11319
|
this._onPointerHover = onPointerHover.bind(this);
|
|
11059
11320
|
this._onPointerMove = onPointerMove.bind(this);
|
|
11060
11321
|
this._onPointerUp = onPointerUp.bind(this);
|
|
11322
|
+
if (domElement !== null) {
|
|
11323
|
+
this.connect(domElement);
|
|
11324
|
+
}
|
|
11325
|
+
}
|
|
11326
|
+
connect(element) {
|
|
11327
|
+
super.connect(element);
|
|
11061
11328
|
this.domElement.addEventListener("pointerdown", this._onPointerDown);
|
|
11062
11329
|
this.domElement.addEventListener("pointermove", this._onPointerHover);
|
|
11063
11330
|
this.domElement.addEventListener("pointerup", this._onPointerUp);
|
|
11331
|
+
this.domElement.style.touchAction = "none";
|
|
11064
11332
|
}
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
|
|
11078
|
-
|
|
11079
|
-
|
|
11080
|
-
if (this.camera.isOrthographicCamera) {
|
|
11081
|
-
this.camera.getWorldDirection(this.eye).negate();
|
|
11082
|
-
} else {
|
|
11083
|
-
this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize();
|
|
11084
|
-
}
|
|
11085
|
-
super.updateMatrixWorld(this);
|
|
11333
|
+
disconnect() {
|
|
11334
|
+
this.domElement.removeEventListener("pointerdown", this._onPointerDown);
|
|
11335
|
+
this.domElement.removeEventListener("pointermove", this._onPointerHover);
|
|
11336
|
+
this.domElement.removeEventListener("pointermove", this._onPointerMove);
|
|
11337
|
+
this.domElement.removeEventListener("pointerup", this._onPointerUp);
|
|
11338
|
+
this.domElement.style.touchAction = "auto";
|
|
11339
|
+
}
|
|
11340
|
+
/**
|
|
11341
|
+
* Returns the visual representation of the controls. Add the helper to your scene to
|
|
11342
|
+
* visually transform the attached 3D object.
|
|
11343
|
+
*
|
|
11344
|
+
* @return {TransformControlsRoot} The helper.
|
|
11345
|
+
*/
|
|
11346
|
+
getHelper() {
|
|
11347
|
+
return this._root;
|
|
11086
11348
|
}
|
|
11087
11349
|
pointerHover(pointer) {
|
|
11088
11350
|
if (this.object === void 0 || this.dragging === true)
|
|
11089
11351
|
return;
|
|
11090
|
-
|
|
11352
|
+
if (pointer !== null)
|
|
11353
|
+
_raycaster.setFromCamera(pointer, this.camera);
|
|
11091
11354
|
const intersect = intersectObjectWithRay(this._gizmo.picker[this.mode], _raycaster);
|
|
11092
11355
|
if (intersect) {
|
|
11093
11356
|
this.axis = intersect.object.name;
|
|
@@ -11096,10 +11359,11 @@ class TransformControls extends THREE$1.Object3D {
|
|
|
11096
11359
|
}
|
|
11097
11360
|
}
|
|
11098
11361
|
pointerDown(pointer) {
|
|
11099
|
-
if (this.object === void 0 || this.dragging === true || pointer.button !== 0)
|
|
11362
|
+
if (this.object === void 0 || this.dragging === true || pointer != null && pointer.button !== 0)
|
|
11100
11363
|
return;
|
|
11101
11364
|
if (this.axis !== null) {
|
|
11102
|
-
|
|
11365
|
+
if (pointer !== null)
|
|
11366
|
+
_raycaster.setFromCamera(pointer, this.camera);
|
|
11103
11367
|
const planeIntersect = intersectObjectWithRay(this._plane, _raycaster, true);
|
|
11104
11368
|
if (planeIntersect) {
|
|
11105
11369
|
this.object.updateMatrixWorld();
|
|
@@ -11125,9 +11389,10 @@ class TransformControls extends THREE$1.Object3D {
|
|
|
11125
11389
|
} else if (axis === "E" || axis === "XYZE" || axis === "XYZ") {
|
|
11126
11390
|
space = "world";
|
|
11127
11391
|
}
|
|
11128
|
-
if (object === void 0 || axis === null || this.dragging === false || pointer.button !== -1)
|
|
11392
|
+
if (object === void 0 || axis === null || this.dragging === false || pointer !== null && pointer.button !== -1)
|
|
11129
11393
|
return;
|
|
11130
|
-
|
|
11394
|
+
if (pointer !== null)
|
|
11395
|
+
_raycaster.setFromCamera(pointer, this.camera);
|
|
11131
11396
|
const planeIntersect = intersectObjectWithRay(this._plane, _raycaster, true);
|
|
11132
11397
|
if (!planeIntersect)
|
|
11133
11398
|
return;
|
|
@@ -11181,6 +11446,9 @@ class TransformControls extends THREE$1.Object3D {
|
|
|
11181
11446
|
}
|
|
11182
11447
|
}
|
|
11183
11448
|
}
|
|
11449
|
+
object.position.x = Math.max(this.minX, Math.min(this.maxX, object.position.x));
|
|
11450
|
+
object.position.y = Math.max(this.minY, Math.min(this.maxY, object.position.y));
|
|
11451
|
+
object.position.z = Math.max(this.minZ, Math.min(this.maxZ, object.position.z));
|
|
11184
11452
|
} else if (mode === "scale") {
|
|
11185
11453
|
if (axis.search("XYZ") !== -1) {
|
|
11186
11454
|
let d = this.pointEnd.length() / this.pointStart.length();
|
|
@@ -11257,7 +11525,7 @@ class TransformControls extends THREE$1.Object3D {
|
|
|
11257
11525
|
this.dispatchEvent(_objectChangeEvent);
|
|
11258
11526
|
}
|
|
11259
11527
|
pointerUp(pointer) {
|
|
11260
|
-
if (pointer.button !== 0)
|
|
11528
|
+
if (pointer !== null && pointer.button !== 0)
|
|
11261
11529
|
return;
|
|
11262
11530
|
if (this.dragging && this.axis !== null) {
|
|
11263
11531
|
_mouseUpEvent.mode = this.mode;
|
|
@@ -11267,30 +11535,34 @@ class TransformControls extends THREE$1.Object3D {
|
|
|
11267
11535
|
this.axis = null;
|
|
11268
11536
|
}
|
|
11269
11537
|
dispose() {
|
|
11270
|
-
this.
|
|
11271
|
-
this.
|
|
11272
|
-
this.domElement.removeEventListener("pointermove", this._onPointerMove);
|
|
11273
|
-
this.domElement.removeEventListener("pointerup", this._onPointerUp);
|
|
11274
|
-
this.traverse(function(child) {
|
|
11275
|
-
if (child.geometry)
|
|
11276
|
-
child.geometry.dispose();
|
|
11277
|
-
if (child.material)
|
|
11278
|
-
child.material.dispose();
|
|
11279
|
-
});
|
|
11538
|
+
this.disconnect();
|
|
11539
|
+
this._root.dispose();
|
|
11280
11540
|
}
|
|
11281
|
-
|
|
11541
|
+
/**
|
|
11542
|
+
* Sets the 3D object that should be transformed and ensures the controls UI is visible.
|
|
11543
|
+
*
|
|
11544
|
+
* @param {Object3D} object - The 3D object that should be transformed.
|
|
11545
|
+
* @return {TransformControls} A reference to this controls.
|
|
11546
|
+
*/
|
|
11282
11547
|
attach(object) {
|
|
11283
11548
|
this.object = object;
|
|
11284
|
-
this.visible = true;
|
|
11549
|
+
this._root.visible = true;
|
|
11285
11550
|
return this;
|
|
11286
11551
|
}
|
|
11287
|
-
|
|
11552
|
+
/**
|
|
11553
|
+
* Removes the current 3D object from the controls and makes the helper UI invisible.
|
|
11554
|
+
*
|
|
11555
|
+
* @return {TransformControls} A reference to this controls.
|
|
11556
|
+
*/
|
|
11288
11557
|
detach() {
|
|
11289
11558
|
this.object = void 0;
|
|
11290
|
-
this.visible = false;
|
|
11291
11559
|
this.axis = null;
|
|
11560
|
+
this._root.visible = false;
|
|
11292
11561
|
return this;
|
|
11293
11562
|
}
|
|
11563
|
+
/**
|
|
11564
|
+
* Resets the object's position, rotation and scale to when the current transform began.
|
|
11565
|
+
*/
|
|
11294
11566
|
reset() {
|
|
11295
11567
|
if (!this.enabled)
|
|
11296
11568
|
return;
|
|
@@ -11303,28 +11575,68 @@ class TransformControls extends THREE$1.Object3D {
|
|
|
11303
11575
|
this.pointStart.copy(this.pointEnd);
|
|
11304
11576
|
}
|
|
11305
11577
|
}
|
|
11578
|
+
/**
|
|
11579
|
+
* Returns the raycaster that is used for user interaction. This object is shared between all
|
|
11580
|
+
* instances of `TransformControls`.
|
|
11581
|
+
*
|
|
11582
|
+
* @returns {Raycaster} The internal raycaster.
|
|
11583
|
+
*/
|
|
11306
11584
|
getRaycaster() {
|
|
11307
11585
|
return _raycaster;
|
|
11308
11586
|
}
|
|
11309
|
-
|
|
11587
|
+
/**
|
|
11588
|
+
* Returns the transformation mode.
|
|
11589
|
+
*
|
|
11590
|
+
* @returns {'translate'|'rotate'|'scale'} The transformation mode.
|
|
11591
|
+
*/
|
|
11310
11592
|
getMode() {
|
|
11311
11593
|
return this.mode;
|
|
11312
11594
|
}
|
|
11595
|
+
/**
|
|
11596
|
+
* Sets the given transformation mode.
|
|
11597
|
+
*
|
|
11598
|
+
* @param {'translate'|'rotate'|'scale'} mode - The transformation mode to set.
|
|
11599
|
+
*/
|
|
11313
11600
|
setMode(mode) {
|
|
11314
11601
|
this.mode = mode;
|
|
11315
11602
|
}
|
|
11603
|
+
/**
|
|
11604
|
+
* Sets the translation snap.
|
|
11605
|
+
*
|
|
11606
|
+
* @param {?number} translationSnap - The translation snap to set.
|
|
11607
|
+
*/
|
|
11316
11608
|
setTranslationSnap(translationSnap) {
|
|
11317
11609
|
this.translationSnap = translationSnap;
|
|
11318
11610
|
}
|
|
11611
|
+
/**
|
|
11612
|
+
* Sets the rotation snap.
|
|
11613
|
+
*
|
|
11614
|
+
* @param {?number} rotationSnap - The rotation snap to set.
|
|
11615
|
+
*/
|
|
11319
11616
|
setRotationSnap(rotationSnap) {
|
|
11320
11617
|
this.rotationSnap = rotationSnap;
|
|
11321
11618
|
}
|
|
11619
|
+
/**
|
|
11620
|
+
* Sets the scale snap.
|
|
11621
|
+
*
|
|
11622
|
+
* @param {?number} scaleSnap - The scale snap to set.
|
|
11623
|
+
*/
|
|
11322
11624
|
setScaleSnap(scaleSnap) {
|
|
11323
11625
|
this.scaleSnap = scaleSnap;
|
|
11324
11626
|
}
|
|
11627
|
+
/**
|
|
11628
|
+
* Sets the size of the helper UI.
|
|
11629
|
+
*
|
|
11630
|
+
* @param {number} size - The size to set.
|
|
11631
|
+
*/
|
|
11325
11632
|
setSize(size) {
|
|
11326
11633
|
this.size = size;
|
|
11327
11634
|
}
|
|
11635
|
+
/**
|
|
11636
|
+
* Sets the coordinate space in which transformations are applied.
|
|
11637
|
+
*
|
|
11638
|
+
* @param {'world'|'local'} space - The space to set.
|
|
11639
|
+
*/
|
|
11328
11640
|
setSpace(space) {
|
|
11329
11641
|
this.space = space;
|
|
11330
11642
|
}
|
|
@@ -11400,6 +11712,45 @@ const _unitZ = new THREE$1.Vector3(0, 0, 1);
|
|
|
11400
11712
|
const _v1 = new THREE$1.Vector3();
|
|
11401
11713
|
const _v2 = new THREE$1.Vector3();
|
|
11402
11714
|
const _v3 = new THREE$1.Vector3();
|
|
11715
|
+
class TransformControlsRoot extends THREE$1.Object3D {
|
|
11716
|
+
constructor(controls) {
|
|
11717
|
+
super();
|
|
11718
|
+
this.isTransformControlsRoot = true;
|
|
11719
|
+
this.controls = controls;
|
|
11720
|
+
this.visible = false;
|
|
11721
|
+
}
|
|
11722
|
+
// updateMatrixWorld updates key transformation variables
|
|
11723
|
+
updateMatrixWorld(force) {
|
|
11724
|
+
const controls = this.controls;
|
|
11725
|
+
if (controls.object !== void 0) {
|
|
11726
|
+
controls.object.updateMatrixWorld();
|
|
11727
|
+
if (controls.object.parent === null) {
|
|
11728
|
+
console.error("TransformControls: The attached 3D object must be a part of the scene graph.");
|
|
11729
|
+
} else {
|
|
11730
|
+
controls.object.parent.matrixWorld.decompose(controls._parentPosition, controls._parentQuaternion, controls._parentScale);
|
|
11731
|
+
}
|
|
11732
|
+
controls.object.matrixWorld.decompose(controls.worldPosition, controls.worldQuaternion, controls._worldScale);
|
|
11733
|
+
controls._parentQuaternionInv.copy(controls._parentQuaternion).invert();
|
|
11734
|
+
controls._worldQuaternionInv.copy(controls.worldQuaternion).invert();
|
|
11735
|
+
}
|
|
11736
|
+
controls.camera.updateMatrixWorld();
|
|
11737
|
+
controls.camera.matrixWorld.decompose(controls.cameraPosition, controls.cameraQuaternion, controls._cameraScale);
|
|
11738
|
+
if (controls.camera.isOrthographicCamera) {
|
|
11739
|
+
controls.camera.getWorldDirection(controls.eye).negate();
|
|
11740
|
+
} else {
|
|
11741
|
+
controls.eye.copy(controls.cameraPosition).sub(controls.worldPosition).normalize();
|
|
11742
|
+
}
|
|
11743
|
+
super.updateMatrixWorld(force);
|
|
11744
|
+
}
|
|
11745
|
+
dispose() {
|
|
11746
|
+
this.traverse(function(child) {
|
|
11747
|
+
if (child.geometry)
|
|
11748
|
+
child.geometry.dispose();
|
|
11749
|
+
if (child.material)
|
|
11750
|
+
child.material.dispose();
|
|
11751
|
+
});
|
|
11752
|
+
}
|
|
11753
|
+
}
|
|
11403
11754
|
class TransformControlsGizmo extends THREE$1.Object3D {
|
|
11404
11755
|
constructor() {
|
|
11405
11756
|
super();
|
|
@@ -12025,7 +12376,7 @@ class SimplePlane {
|
|
|
12025
12376
|
/** {@link Hideable.visible } */
|
|
12026
12377
|
set visible(state) {
|
|
12027
12378
|
this._visible = state;
|
|
12028
|
-
this._controls.visible = state;
|
|
12379
|
+
this._controls.object.visible = state;
|
|
12029
12380
|
this._helper.visible = state;
|
|
12030
12381
|
this.toggleControls(state);
|
|
12031
12382
|
}
|
|
@@ -12092,7 +12443,7 @@ class SimplePlane {
|
|
|
12092
12443
|
this._arrowBoundBox.removeFromParent();
|
|
12093
12444
|
this._arrowBoundBox.geometry.dispose();
|
|
12094
12445
|
this._planeMesh.geometry.dispose();
|
|
12095
|
-
this._controls.removeFromParent();
|
|
12446
|
+
this._controls.object.removeFromParent();
|
|
12096
12447
|
this._controls.dispose();
|
|
12097
12448
|
this.onDisposed.trigger();
|
|
12098
12449
|
this.onDisposed.reset();
|
|
@@ -12128,7 +12479,7 @@ class SimplePlane {
|
|
|
12128
12479
|
const container = this.world.renderer.three.domElement;
|
|
12129
12480
|
const controls = new TransformControls(camera, container);
|
|
12130
12481
|
this.initializeControls(controls);
|
|
12131
|
-
this.world.scene.three.add(controls);
|
|
12482
|
+
this.world.scene.three.add(controls.object);
|
|
12132
12483
|
return controls;
|
|
12133
12484
|
}
|
|
12134
12485
|
initializeControls(controls) {
|
|
@@ -12137,7 +12488,7 @@ class SimplePlane {
|
|
|
12137
12488
|
controls.showY = false;
|
|
12138
12489
|
controls.setSpace("local");
|
|
12139
12490
|
this.createArrowBoundingBox();
|
|
12140
|
-
controls.children[0].children[0].add(this._arrowBoundBox);
|
|
12491
|
+
controls.object.children[0].children[0].add(this._arrowBoundBox);
|
|
12141
12492
|
}
|
|
12142
12493
|
createArrowBoundingBox() {
|
|
12143
12494
|
this._arrowBoundBox.geometry = new THREE__namespace.CylinderGeometry(0.18, 0.18, 1.2);
|
|
@@ -12495,12 +12846,12 @@ const _Clipper = class _Clipper extends Component {
|
|
|
12495
12846
|
return meshes;
|
|
12496
12847
|
}
|
|
12497
12848
|
createPlaneFromIntersection(world, intersect) {
|
|
12498
|
-
var
|
|
12849
|
+
var _a2;
|
|
12499
12850
|
if (!world.renderer) {
|
|
12500
12851
|
throw new Error("The given world must have a renderer!");
|
|
12501
12852
|
}
|
|
12502
12853
|
const constant = intersect.point.distanceTo(new THREE__namespace.Vector3(0, 0, 0));
|
|
12503
|
-
const normal = (
|
|
12854
|
+
const normal = (_a2 = intersect.face) == null ? void 0 : _a2.normal;
|
|
12504
12855
|
if (!constant || !normal) {
|
|
12505
12856
|
return null;
|
|
12506
12857
|
}
|
|
@@ -14408,7 +14759,7 @@ const IfcCategoryMap = {
|
|
|
14408
14759
|
};
|
|
14409
14760
|
class IfcPropertiesUtils {
|
|
14410
14761
|
static async getUnits(group) {
|
|
14411
|
-
var
|
|
14762
|
+
var _a2, _b, _c;
|
|
14412
14763
|
const { IFCUNITASSIGNMENT } = WEBIFC__namespace;
|
|
14413
14764
|
const allUnitsSets = await group.getAllPropertiesOfType(IFCUNITASSIGNMENT);
|
|
14414
14765
|
if (!allUnitsSets) {
|
|
@@ -14434,7 +14785,7 @@ class IfcPropertiesUtils {
|
|
|
14434
14785
|
if (unit.Name.value === "FOOT") {
|
|
14435
14786
|
unitValue = 0.3048;
|
|
14436
14787
|
}
|
|
14437
|
-
if (((
|
|
14788
|
+
if (((_a2 = unit.Prefix) == null ? void 0 : _a2.value) === "MILLI") {
|
|
14438
14789
|
factor = 1e-3;
|
|
14439
14790
|
} else if (((_b = unit.Prefix) == null ? void 0 : _b.value) === "CENTI") {
|
|
14440
14791
|
factor = 0.01;
|
|
@@ -14446,18 +14797,18 @@ class IfcPropertiesUtils {
|
|
|
14446
14797
|
return 1;
|
|
14447
14798
|
}
|
|
14448
14799
|
static async findItemByGuid(model, guid) {
|
|
14449
|
-
var
|
|
14800
|
+
var _a2;
|
|
14450
14801
|
const ids = model.getAllPropertiesIDs();
|
|
14451
14802
|
for (const id of ids) {
|
|
14452
14803
|
const property = await model.getProperties(id);
|
|
14453
|
-
if (property && ((
|
|
14804
|
+
if (property && ((_a2 = property.GlobalId) == null ? void 0 : _a2.value) === guid) {
|
|
14454
14805
|
return property;
|
|
14455
14806
|
}
|
|
14456
14807
|
}
|
|
14457
14808
|
return null;
|
|
14458
14809
|
}
|
|
14459
14810
|
static async getRelationMap(model, relationType, onElementsFound) {
|
|
14460
|
-
var
|
|
14811
|
+
var _a2;
|
|
14461
14812
|
const defaultCallback = async () => {
|
|
14462
14813
|
};
|
|
14463
14814
|
const _onElementsFound = onElementsFound ?? defaultCallback;
|
|
@@ -14477,7 +14828,7 @@ class IfcPropertiesUtils {
|
|
|
14477
14828
|
);
|
|
14478
14829
|
if (!(isRelation && relatingKey && relatedKey))
|
|
14479
14830
|
continue;
|
|
14480
|
-
const relating = await model.getProperties((
|
|
14831
|
+
const relating = await model.getProperties((_a2 = prop[relatingKey]) == null ? void 0 : _a2.value);
|
|
14481
14832
|
const related = prop[relatedKey];
|
|
14482
14833
|
if (!relating || !related) {
|
|
14483
14834
|
continue;
|
|
@@ -14525,7 +14876,7 @@ class IfcPropertiesUtils {
|
|
|
14525
14876
|
return props.filter((prop) => prop !== null);
|
|
14526
14877
|
}
|
|
14527
14878
|
static async getPsetRel(model, psetID) {
|
|
14528
|
-
var
|
|
14879
|
+
var _a2;
|
|
14529
14880
|
const prop = await model.getProperties(psetID);
|
|
14530
14881
|
if (!prop) {
|
|
14531
14882
|
return null;
|
|
@@ -14539,7 +14890,7 @@ class IfcPropertiesUtils {
|
|
|
14539
14890
|
const allRels = Object.values(allPropsRels);
|
|
14540
14891
|
let found = null;
|
|
14541
14892
|
for (const rel of allRels) {
|
|
14542
|
-
if (((
|
|
14893
|
+
if (((_a2 = rel.RelatingPropertyDefinition) == null ? void 0 : _a2.value) === psetID) {
|
|
14543
14894
|
found = rel.expressID;
|
|
14544
14895
|
}
|
|
14545
14896
|
}
|
|
@@ -14549,13 +14900,13 @@ class IfcPropertiesUtils {
|
|
|
14549
14900
|
return IfcPropertiesUtils.getPsetRel(model, qsetID);
|
|
14550
14901
|
}
|
|
14551
14902
|
static async getEntityName(model, entityID) {
|
|
14552
|
-
var
|
|
14903
|
+
var _a2;
|
|
14553
14904
|
const entity = await model.getProperties(entityID);
|
|
14554
14905
|
if (!entity) {
|
|
14555
14906
|
return { key: null, name: null };
|
|
14556
14907
|
}
|
|
14557
14908
|
const key = Object.keys(entity).find((key2) => key2.endsWith("Name")) ?? null;
|
|
14558
|
-
const name = key ? (
|
|
14909
|
+
const name = key ? (_a2 = entity[key]) == null ? void 0 : _a2.value : null;
|
|
14559
14910
|
return { key, name };
|
|
14560
14911
|
}
|
|
14561
14912
|
static async getQuantityValue(model, quantityID) {
|
|
@@ -14586,7 +14937,7 @@ class IfcPropertiesUtils {
|
|
|
14586
14937
|
return Object.keys(entity).includes(attribute);
|
|
14587
14938
|
}
|
|
14588
14939
|
static async groupEntitiesByType(model, expressIDs) {
|
|
14589
|
-
var
|
|
14940
|
+
var _a2;
|
|
14590
14941
|
const categoriesMap = /* @__PURE__ */ new Map();
|
|
14591
14942
|
for (const expressID of expressIDs) {
|
|
14592
14943
|
const entity = await model.getProperties(expressID);
|
|
@@ -14597,7 +14948,7 @@ class IfcPropertiesUtils {
|
|
|
14597
14948
|
const set = categoriesMap.get(key);
|
|
14598
14949
|
if (!set)
|
|
14599
14950
|
categoriesMap.set(key, /* @__PURE__ */ new Set());
|
|
14600
|
-
(
|
|
14951
|
+
(_a2 = categoriesMap.get(key)) == null ? void 0 : _a2.add(expressID);
|
|
14601
14952
|
}
|
|
14602
14953
|
return categoriesMap;
|
|
14603
14954
|
}
|
|
@@ -15772,7 +16123,7 @@ class Units {
|
|
|
15772
16123
|
matrix.copy(result);
|
|
15773
16124
|
}
|
|
15774
16125
|
setUp(webIfc) {
|
|
15775
|
-
var
|
|
16126
|
+
var _a2, _b, _c;
|
|
15776
16127
|
this.factor = 1;
|
|
15777
16128
|
const length = this.getLengthUnits(webIfc);
|
|
15778
16129
|
if (!length) {
|
|
@@ -15786,7 +16137,7 @@ class Units {
|
|
|
15786
16137
|
if (length.Name.value === "FOOT") {
|
|
15787
16138
|
this.factor = 0.3048;
|
|
15788
16139
|
}
|
|
15789
|
-
if (((
|
|
16140
|
+
if (((_a2 = length.Prefix) == null ? void 0 : _a2.value) === "MILLI") {
|
|
15790
16141
|
this.complement = 1e-3;
|
|
15791
16142
|
} else if (((_b = length.Prefix) == null ? void 0 : _b.value) === "CENTI") {
|
|
15792
16143
|
this.complement = 0.01;
|
|
@@ -16044,7 +16395,7 @@ class CivilReader {
|
|
|
16044
16395
|
}
|
|
16045
16396
|
class IfcMetadataReader {
|
|
16046
16397
|
getNameInfo(webIfc) {
|
|
16047
|
-
var
|
|
16398
|
+
var _a2;
|
|
16048
16399
|
const data = {};
|
|
16049
16400
|
const { arguments: dataArguments } = webIfc.GetHeaderLine(0, WEBIFC__namespace.FILE_NAME) || {};
|
|
16050
16401
|
if (!dataArguments)
|
|
@@ -16070,7 +16421,7 @@ class IfcMetadataReader {
|
|
|
16070
16421
|
if (authorEmail == null ? void 0 : authorEmail.value)
|
|
16071
16422
|
data.author.email = authorEmail.value;
|
|
16072
16423
|
}
|
|
16073
|
-
if (organization && ((
|
|
16424
|
+
if (organization && ((_a2 = organization[0]) == null ? void 0 : _a2.value)) {
|
|
16074
16425
|
data.organization = organization[0].value;
|
|
16075
16426
|
}
|
|
16076
16427
|
if (preprocessorVersion == null ? void 0 : preprocessorVersion.value) {
|
|
@@ -16085,13 +16436,13 @@ class IfcMetadataReader {
|
|
|
16085
16436
|
return data;
|
|
16086
16437
|
}
|
|
16087
16438
|
getDescriptionInfo(webIfc) {
|
|
16088
|
-
var
|
|
16439
|
+
var _a2;
|
|
16089
16440
|
const data = {};
|
|
16090
16441
|
const { arguments: dataArguments } = webIfc.GetHeaderLine(0, WEBIFC__namespace.FILE_DESCRIPTION) || {};
|
|
16091
16442
|
if (!dataArguments)
|
|
16092
16443
|
return data;
|
|
16093
16444
|
const [description, implementationLevel] = dataArguments;
|
|
16094
|
-
if (Array.isArray(description) && ((
|
|
16445
|
+
if (Array.isArray(description) && ((_a2 = description[0]) == null ? void 0 : _a2.value)) {
|
|
16095
16446
|
const viewDefinition = description[0].value.match(/\[([^\]]+)\]/);
|
|
16096
16447
|
if (viewDefinition && viewDefinition[1]) {
|
|
16097
16448
|
data.viewDefinition = viewDefinition[1];
|
|
@@ -22322,12 +22673,12 @@ class Comment {
|
|
|
22322
22673
|
* @param value - The new comment text.
|
|
22323
22674
|
*/
|
|
22324
22675
|
set comment(value) {
|
|
22325
|
-
var
|
|
22676
|
+
var _a2;
|
|
22326
22677
|
const manager = this._components.get(BCFTopics);
|
|
22327
22678
|
this._comment = value;
|
|
22328
22679
|
this.modifiedDate = /* @__PURE__ */ new Date();
|
|
22329
22680
|
this.modifiedAuthor = manager.config.author;
|
|
22330
|
-
(
|
|
22681
|
+
(_a2 = this.topic) == null ? void 0 : _a2.comments.set(this.guid, this);
|
|
22331
22682
|
}
|
|
22332
22683
|
/**
|
|
22333
22684
|
* Gets the comment text.
|
|
@@ -23210,12 +23561,12 @@ ${users}
|
|
|
23210
23561
|
return comment;
|
|
23211
23562
|
}
|
|
23212
23563
|
getMarkupComments(markup, version) {
|
|
23213
|
-
var
|
|
23564
|
+
var _a2;
|
|
23214
23565
|
let data;
|
|
23215
23566
|
if (version === "2.1")
|
|
23216
23567
|
data = markup.Comment;
|
|
23217
23568
|
if (version === "3")
|
|
23218
|
-
data = (
|
|
23569
|
+
data = (_a2 = markup.Topic.Comments) == null ? void 0 : _a2.Comment;
|
|
23219
23570
|
if (!data)
|
|
23220
23571
|
return [];
|
|
23221
23572
|
data = Array.isArray(data) ? data : [data];
|
|
@@ -23224,36 +23575,36 @@ ${users}
|
|
|
23224
23575
|
return array;
|
|
23225
23576
|
}
|
|
23226
23577
|
getMarkupLabels(markup, version) {
|
|
23227
|
-
var
|
|
23578
|
+
var _a2;
|
|
23228
23579
|
let data;
|
|
23229
23580
|
if (version === "2.1")
|
|
23230
23581
|
data = markup.Topic.Labels;
|
|
23231
23582
|
if (version === "3")
|
|
23232
|
-
data = (
|
|
23583
|
+
data = (_a2 = markup.Topic.Labels) == null ? void 0 : _a2.Label;
|
|
23233
23584
|
if (!data)
|
|
23234
23585
|
return [];
|
|
23235
23586
|
const labels = Array.isArray(data) ? data : [data];
|
|
23236
23587
|
return labels;
|
|
23237
23588
|
}
|
|
23238
23589
|
getMarkupViewpoints(markup, version) {
|
|
23239
|
-
var
|
|
23590
|
+
var _a2;
|
|
23240
23591
|
let data;
|
|
23241
23592
|
if (version === "2.1")
|
|
23242
23593
|
data = markup.Viewpoints;
|
|
23243
23594
|
if (version === "3")
|
|
23244
|
-
data = (
|
|
23595
|
+
data = (_a2 = markup.Topic.Viewpoints) == null ? void 0 : _a2.ViewPoint;
|
|
23245
23596
|
if (!data)
|
|
23246
23597
|
return [];
|
|
23247
23598
|
data = Array.isArray(data) ? data : [data];
|
|
23248
23599
|
return data;
|
|
23249
23600
|
}
|
|
23250
23601
|
getMarkupRelatedTopics(markup, version) {
|
|
23251
|
-
var
|
|
23602
|
+
var _a2;
|
|
23252
23603
|
let data;
|
|
23253
23604
|
if (version === "2.1")
|
|
23254
23605
|
data = markup.Topic.RelatedTopic;
|
|
23255
23606
|
if (version === "3")
|
|
23256
|
-
data = (
|
|
23607
|
+
data = (_a2 = markup.Topic.RelatedTopics) == null ? void 0 : _a2.RelatedTopic;
|
|
23257
23608
|
if (!data)
|
|
23258
23609
|
return [];
|
|
23259
23610
|
const topics = Array.isArray(data) ? data : [data];
|
|
@@ -23270,7 +23621,7 @@ ${users}
|
|
|
23270
23621
|
* @throws An error if the BCF version is not supported.
|
|
23271
23622
|
*/
|
|
23272
23623
|
async load(data, world) {
|
|
23273
|
-
var
|
|
23624
|
+
var _a2;
|
|
23274
23625
|
const {
|
|
23275
23626
|
fallbackVersionOnImport,
|
|
23276
23627
|
ignoreIncompleteTopicsOnImport,
|
|
@@ -23335,7 +23686,7 @@ ${users}
|
|
|
23335
23686
|
ViewSetupHints = Components2.ViewSetupHints;
|
|
23336
23687
|
}
|
|
23337
23688
|
if (version === "3") {
|
|
23338
|
-
ViewSetupHints = (
|
|
23689
|
+
ViewSetupHints = (_a2 = Components2.Visibility) == null ? void 0 : _a2.ViewSetupHints;
|
|
23339
23690
|
}
|
|
23340
23691
|
if (ViewSetupHints) {
|
|
23341
23692
|
if ("OpeningsVisible" in ViewSetupHints) {
|
|
@@ -24807,7 +25158,7 @@ const _Classifier = class _Classifier extends Component {
|
|
|
24807
25158
|
* @throws Will throw an error if the fragment ID is not found.
|
|
24808
25159
|
*/
|
|
24809
25160
|
async byPredefinedType(group) {
|
|
24810
|
-
var
|
|
25161
|
+
var _a2;
|
|
24811
25162
|
if (!this.list.predefinedTypes) {
|
|
24812
25163
|
this.list.predefinedTypes = {};
|
|
24813
25164
|
}
|
|
@@ -24817,7 +25168,7 @@ const _Classifier = class _Classifier extends Component {
|
|
|
24817
25168
|
const entity = await group.getProperties(id);
|
|
24818
25169
|
if (!entity)
|
|
24819
25170
|
continue;
|
|
24820
|
-
const predefinedType = String((
|
|
25171
|
+
const predefinedType = String((_a2 = entity.PredefinedType) == null ? void 0 : _a2.value).toUpperCase();
|
|
24821
25172
|
if (!currentTypes[predefinedType]) {
|
|
24822
25173
|
currentTypes[predefinedType] = {
|
|
24823
25174
|
map: {},
|
|
@@ -24920,7 +25271,7 @@ const _Classifier = class _Classifier extends Component {
|
|
|
24920
25271
|
* @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
|
|
24921
25272
|
*/
|
|
24922
25273
|
async bySpatialStructure(model, config = {}) {
|
|
24923
|
-
var
|
|
25274
|
+
var _a2, _b;
|
|
24924
25275
|
const indexer = this.components.get(IfcRelationsIndexer);
|
|
24925
25276
|
const modelRelations = indexer.relationMaps[model.uuid];
|
|
24926
25277
|
if (!modelRelations) {
|
|
@@ -24954,7 +25305,7 @@ const _Classifier = class _Classifier extends Component {
|
|
|
24954
25305
|
if (!spatialRelAttrs) {
|
|
24955
25306
|
continue;
|
|
24956
25307
|
}
|
|
24957
|
-
relName2 = (
|
|
25308
|
+
relName2 = (_a2 = spatialRelAttrs.Name) == null ? void 0 : _a2.value;
|
|
24958
25309
|
}
|
|
24959
25310
|
this.saveItem(model, systemName, relName2, expressID, id);
|
|
24960
25311
|
}
|
|
@@ -26219,7 +26570,7 @@ class Viewpoint {
|
|
|
26219
26570
|
}
|
|
26220
26571
|
}
|
|
26221
26572
|
async createComponentTags(from) {
|
|
26222
|
-
var
|
|
26573
|
+
var _a2, _b;
|
|
26223
26574
|
const fragments = this._components.get(FragmentsManager);
|
|
26224
26575
|
const manager = this._components.get(BCFTopics);
|
|
26225
26576
|
let tags = "";
|
|
@@ -26234,7 +26585,7 @@ class Viewpoint {
|
|
|
26234
26585
|
const attrs = await model.getProperties(expressID);
|
|
26235
26586
|
if (!attrs)
|
|
26236
26587
|
continue;
|
|
26237
|
-
const globalID = (
|
|
26588
|
+
const globalID = (_a2 = attrs.GlobalId) == null ? void 0 : _a2.value;
|
|
26238
26589
|
if (!globalID)
|
|
26239
26590
|
continue;
|
|
26240
26591
|
const tag = (_b = attrs.Tag) == null ? void 0 : _b.value;
|
|
@@ -27407,14 +27758,14 @@ class IDSAttribute extends IDSFacet {
|
|
|
27407
27758
|
// All invalid cases have been treated as failures
|
|
27408
27759
|
// FragmentsGroup do not hold some of the entities used in the tests
|
|
27409
27760
|
async test(entities) {
|
|
27410
|
-
var
|
|
27761
|
+
var _a2;
|
|
27411
27762
|
this.testResult = [];
|
|
27412
27763
|
for (const _expressID in entities) {
|
|
27413
27764
|
const expressID = Number(_expressID);
|
|
27414
27765
|
const attrs = entities[expressID];
|
|
27415
27766
|
const checks = [];
|
|
27416
27767
|
const result2 = {
|
|
27417
|
-
guid: (
|
|
27768
|
+
guid: (_a2 = attrs.GlobalId) == null ? void 0 : _a2.value,
|
|
27418
27769
|
expressID,
|
|
27419
27770
|
pass: false,
|
|
27420
27771
|
checks,
|
|
@@ -27508,7 +27859,7 @@ class IDSClassification extends IDSFacet {
|
|
|
27508
27859
|
</classification>`;
|
|
27509
27860
|
}
|
|
27510
27861
|
async getEntities(model, collector = {}) {
|
|
27511
|
-
var
|
|
27862
|
+
var _a2;
|
|
27512
27863
|
const result = [];
|
|
27513
27864
|
const references = await model.getAllPropertiesOfType(
|
|
27514
27865
|
WEBIFC__namespace.IFCCLASSIFICATIONREFERENCE
|
|
@@ -27523,7 +27874,7 @@ class IDSClassification extends IDSFacet {
|
|
|
27523
27874
|
const attrs = await model.getProperties(classificationID);
|
|
27524
27875
|
if (!attrs)
|
|
27525
27876
|
continue;
|
|
27526
|
-
const referencedSourceID = (
|
|
27877
|
+
const referencedSourceID = (_a2 = attrs.ReferencedSource) == null ? void 0 : _a2.value;
|
|
27527
27878
|
if (!referencedSourceID)
|
|
27528
27879
|
continue;
|
|
27529
27880
|
const classificationAttrs = await model.getProperties(referencedSourceID);
|
|
@@ -27560,14 +27911,14 @@ class IDSClassification extends IDSFacet {
|
|
|
27560
27911
|
return result;
|
|
27561
27912
|
}
|
|
27562
27913
|
async test(entities, model) {
|
|
27563
|
-
var
|
|
27914
|
+
var _a2;
|
|
27564
27915
|
this.testResult = [];
|
|
27565
27916
|
for (const _expressID in entities) {
|
|
27566
27917
|
const expressID = Number(_expressID);
|
|
27567
27918
|
const attrs = entities[expressID];
|
|
27568
27919
|
const checks = [];
|
|
27569
27920
|
const result2 = {
|
|
27570
|
-
guid: (
|
|
27921
|
+
guid: (_a2 = attrs.GlobalId) == null ? void 0 : _a2.value,
|
|
27571
27922
|
expressID,
|
|
27572
27923
|
pass: false,
|
|
27573
27924
|
checks,
|
|
@@ -27610,8 +27961,8 @@ class IDSClassification extends IDSFacet {
|
|
|
27610
27961
|
return result;
|
|
27611
27962
|
}
|
|
27612
27963
|
async processReferencedSource(model, attrs) {
|
|
27613
|
-
var
|
|
27614
|
-
const sourceID = (
|
|
27964
|
+
var _a2;
|
|
27965
|
+
const sourceID = (_a2 = attrs.ReferencedSource) == null ? void 0 : _a2.value;
|
|
27615
27966
|
if (!sourceID)
|
|
27616
27967
|
return null;
|
|
27617
27968
|
const sourceAttrs = await model.getProperties(sourceID);
|
|
@@ -27626,7 +27977,7 @@ class IDSClassification extends IDSFacet {
|
|
|
27626
27977
|
return sourceAttrs;
|
|
27627
27978
|
}
|
|
27628
27979
|
async getSystems(model, expressID) {
|
|
27629
|
-
var
|
|
27980
|
+
var _a2;
|
|
27630
27981
|
const result = [];
|
|
27631
27982
|
const indexer = this.components.get(IfcRelationsIndexer);
|
|
27632
27983
|
const ocurrenceAssociations = indexer.getEntityRelations(
|
|
@@ -27653,9 +28004,9 @@ class IDSClassification extends IDSFacet {
|
|
|
27653
28004
|
}
|
|
27654
28005
|
}
|
|
27655
28006
|
const occurrenceSystems = result.map((attrs) => {
|
|
27656
|
-
var
|
|
28007
|
+
var _a3, _b, _c;
|
|
27657
28008
|
if (attrs.type === WEBIFC__namespace.IFCCLASSIFICATION) {
|
|
27658
|
-
return (
|
|
28009
|
+
return (_a3 = attrs.Name) == null ? void 0 : _a3.value;
|
|
27659
28010
|
}
|
|
27660
28011
|
if (attrs.type === WEBIFC__namespace.IFCCLASSIFICATIONREFERENCE) {
|
|
27661
28012
|
return (_c = (_b = attrs.ReferencedSource) == null ? void 0 : _b.Name) == null ? void 0 : _c.value;
|
|
@@ -27677,7 +28028,7 @@ class IDSClassification extends IDSFacet {
|
|
|
27677
28028
|
if (!attrs)
|
|
27678
28029
|
continue;
|
|
27679
28030
|
if (attrs.type === WEBIFC__namespace.IFCCLASSIFICATION) {
|
|
27680
|
-
if (occurrenceSystems.includes((
|
|
28031
|
+
if (occurrenceSystems.includes((_a2 = attrs.Name) == null ? void 0 : _a2.value))
|
|
27681
28032
|
continue;
|
|
27682
28033
|
result.push(attrs);
|
|
27683
28034
|
}
|
|
@@ -27694,9 +28045,9 @@ class IDSClassification extends IDSFacet {
|
|
|
27694
28045
|
return result;
|
|
27695
28046
|
}
|
|
27696
28047
|
getSystemName(attrs) {
|
|
27697
|
-
var
|
|
28048
|
+
var _a2, _b, _c, _d;
|
|
27698
28049
|
if (attrs.type === WEBIFC__namespace.IFCCLASSIFICATION) {
|
|
27699
|
-
return (
|
|
28050
|
+
return (_a2 = attrs.Name) == null ? void 0 : _a2.value;
|
|
27700
28051
|
}
|
|
27701
28052
|
if (attrs.type === WEBIFC__namespace.IFCCLASSIFICATIONREFERENCE) {
|
|
27702
28053
|
if (((_b = attrs.ReferencedSource) == null ? void 0 : _b.type) === WEBIFC__namespace.IFCCLASSIFICATIONREFERENCE) {
|
|
@@ -27752,11 +28103,11 @@ class IDSClassification extends IDSFacet {
|
|
|
27752
28103
|
return !!identifier;
|
|
27753
28104
|
}
|
|
27754
28105
|
evalURI(attrs, checks) {
|
|
27755
|
-
var
|
|
28106
|
+
var _a2;
|
|
27756
28107
|
if (!this.uri)
|
|
27757
28108
|
return true;
|
|
27758
28109
|
const result = this.evalRequirement(
|
|
27759
|
-
(
|
|
28110
|
+
(_a2 = attrs.Location) == null ? void 0 : _a2.value,
|
|
27760
28111
|
{
|
|
27761
28112
|
type: "simple",
|
|
27762
28113
|
parameter: this.uri
|
|
@@ -27828,14 +28179,14 @@ class IDSEntity extends IDSFacet {
|
|
|
27828
28179
|
return result;
|
|
27829
28180
|
}
|
|
27830
28181
|
async test(entities, model) {
|
|
27831
|
-
var
|
|
28182
|
+
var _a2;
|
|
27832
28183
|
this.testResult = [];
|
|
27833
28184
|
for (const _expressID in entities) {
|
|
27834
28185
|
const expressID = Number(_expressID);
|
|
27835
28186
|
const attrs = entities[expressID];
|
|
27836
28187
|
const checks = [];
|
|
27837
28188
|
const result = {
|
|
27838
|
-
guid: (
|
|
28189
|
+
guid: (_a2 = attrs.GlobalId) == null ? void 0 : _a2.value,
|
|
27839
28190
|
expressID,
|
|
27840
28191
|
pass: false,
|
|
27841
28192
|
checks,
|
|
@@ -27854,12 +28205,12 @@ class IDSEntity extends IDSFacet {
|
|
|
27854
28205
|
return result;
|
|
27855
28206
|
}
|
|
27856
28207
|
async evalPredefinedType(model, attrs, checks) {
|
|
27857
|
-
var
|
|
28208
|
+
var _a2, _b, _c, _d;
|
|
27858
28209
|
if (!this.predefinedType)
|
|
27859
28210
|
return null;
|
|
27860
28211
|
const indexer = this.components.get(IfcRelationsIndexer);
|
|
27861
28212
|
const isRequirementUserDefined = typeof this.predefinedType.parameter === "string" && this.predefinedType.parameter === "USERDEFINED";
|
|
27862
|
-
let value = (
|
|
28213
|
+
let value = (_a2 = attrs.PredefinedType) == null ? void 0 : _a2.value;
|
|
27863
28214
|
if (value === "USERDEFINED" && !isRequirementUserDefined) {
|
|
27864
28215
|
const attrNames = Object.keys(attrs);
|
|
27865
28216
|
const result2 = attrNames.find(
|
|
@@ -27931,7 +28282,7 @@ class IDSProperty extends IDSFacet {
|
|
|
27931
28282
|
</property>`;
|
|
27932
28283
|
}
|
|
27933
28284
|
async getEntities(model, collector = {}) {
|
|
27934
|
-
var
|
|
28285
|
+
var _a2, _b;
|
|
27935
28286
|
let sets = {};
|
|
27936
28287
|
const psets = await model.getAllPropertiesOfType(WEBIFC__namespace.IFCPROPERTYSET);
|
|
27937
28288
|
sets = { ...sets, ...psets };
|
|
@@ -27945,7 +28296,7 @@ class IDSProperty extends IDSFacet {
|
|
|
27945
28296
|
const attrs = await model.getProperties(setID);
|
|
27946
28297
|
if (!attrs)
|
|
27947
28298
|
continue;
|
|
27948
|
-
const nameMatches = ((
|
|
28299
|
+
const nameMatches = ((_a2 = attrs.Name) == null ? void 0 : _a2.value) === this.propertySet.parameter;
|
|
27949
28300
|
if (!nameMatches)
|
|
27950
28301
|
continue;
|
|
27951
28302
|
let propsListName;
|
|
@@ -27994,14 +28345,14 @@ class IDSProperty extends IDSFacet {
|
|
|
27994
28345
|
return [];
|
|
27995
28346
|
}
|
|
27996
28347
|
async test(entities, model) {
|
|
27997
|
-
var
|
|
28348
|
+
var _a2;
|
|
27998
28349
|
this.testResult = [];
|
|
27999
28350
|
for (const _expressID in entities) {
|
|
28000
28351
|
const expressID = Number(_expressID);
|
|
28001
28352
|
const attrs = entities[expressID];
|
|
28002
28353
|
const checks = [];
|
|
28003
28354
|
const result2 = {
|
|
28004
|
-
guid: (
|
|
28355
|
+
guid: (_a2 = attrs.GlobalId) == null ? void 0 : _a2.value,
|
|
28005
28356
|
expressID,
|
|
28006
28357
|
pass: false,
|
|
28007
28358
|
checks,
|
|
@@ -28046,12 +28397,12 @@ class IDSProperty extends IDSFacet {
|
|
|
28046
28397
|
}
|
|
28047
28398
|
const items = set.Properties;
|
|
28048
28399
|
const matchingItems = items.filter((item) => {
|
|
28049
|
-
var
|
|
28400
|
+
var _a3;
|
|
28050
28401
|
if (this._unsupportedTypes.includes(item.type)) {
|
|
28051
28402
|
return false;
|
|
28052
28403
|
}
|
|
28053
28404
|
const result3 = this.evalRequirement(
|
|
28054
|
-
((
|
|
28405
|
+
((_a3 = item.Name) == null ? void 0 : _a3.value) ?? null,
|
|
28055
28406
|
this.baseName,
|
|
28056
28407
|
"BaseName"
|
|
28057
28408
|
);
|
|
@@ -28100,7 +28451,7 @@ class IDSProperty extends IDSFacet {
|
|
|
28100
28451
|
);
|
|
28101
28452
|
}
|
|
28102
28453
|
async simplifyPset(model, attrs, propsListName) {
|
|
28103
|
-
var
|
|
28454
|
+
var _a2;
|
|
28104
28455
|
const props = [];
|
|
28105
28456
|
const list = attrs[propsListName];
|
|
28106
28457
|
if (!list)
|
|
@@ -28111,7 +28462,7 @@ class IDSProperty extends IDSFacet {
|
|
|
28111
28462
|
props.push(propAttrs);
|
|
28112
28463
|
}
|
|
28113
28464
|
const attrsClone = {
|
|
28114
|
-
Name: (
|
|
28465
|
+
Name: (_a2 = attrs.Name) == null ? void 0 : _a2.value,
|
|
28115
28466
|
Properties: props,
|
|
28116
28467
|
type: attrs.type
|
|
28117
28468
|
};
|
|
@@ -28138,7 +28489,7 @@ class IDSProperty extends IDSFacet {
|
|
|
28138
28489
|
return sets;
|
|
28139
28490
|
}
|
|
28140
28491
|
async getPsets(model, expressID) {
|
|
28141
|
-
var
|
|
28492
|
+
var _a2;
|
|
28142
28493
|
const typePsets = await this.getTypePsets(model, expressID);
|
|
28143
28494
|
const indexer = this.components.get(IfcRelationsIndexer);
|
|
28144
28495
|
const definitions = indexer.getEntityRelations(
|
|
@@ -28166,7 +28517,7 @@ class IDSProperty extends IDSFacet {
|
|
|
28166
28517
|
);
|
|
28167
28518
|
if (typePset) {
|
|
28168
28519
|
for (const prop of typePset.Properties) {
|
|
28169
|
-
const name = (
|
|
28520
|
+
const name = (_a2 = prop.Name) == null ? void 0 : _a2.value;
|
|
28170
28521
|
const existingProp = occurencePset.Properties.find(
|
|
28171
28522
|
({ Name }) => Name.value === name
|
|
28172
28523
|
);
|