@xeokit/xeokit-sdk 2.6.35 → 2.6.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.6.35",
3
+ "version": "2.6.36",
4
4
  "description": "Web Programming Toolkit for 3D/2D BIM and AEC Graphics",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
@@ -172,8 +172,13 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
172
172
  }
173
173
 
174
174
  const touch = event.touches[0];
175
- const touchX = touch.clientX;
176
- const touchY = touch.clientY;
175
+
176
+ // Get the canvas's bounding rectangle
177
+ const rect = canvas.getBoundingClientRect();
178
+
179
+ // Calculate the touch position relative to the canvas
180
+ const touchX = touch.clientX - rect.left;
181
+ const touchY = touch.clientY - rect.top;
177
182
 
178
183
  touchStartCanvasPos.set([touchX, touchY]);
179
184
  touchMoveCanvasPos.set([touchX, touchY]);
@@ -381,9 +386,14 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
381
386
  }
382
387
 
383
388
  const touch = event.touches[0];
384
- const touchX = touch.clientX;
385
- const touchY = touch.clientY;
386
389
 
390
+ // Get the canvas's bounding rectangle
391
+ const rect = canvas.getBoundingClientRect();
392
+
393
+ // Calculate the touch position relative to the canvas
394
+ const touchX = touch.clientX - rect.left;
395
+ const touchY = touch.clientY - rect.top;
396
+
387
397
  if (touch.identifier !== touchId) {
388
398
  return;
389
399
  }
@@ -553,8 +563,13 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
553
563
  }
554
564
 
555
565
  const touch = event.changedTouches[0];
556
- const touchX = touch.clientX;
557
- const touchY = touch.clientY;
566
+
567
+ // Get the canvas's bounding rectangle
568
+ const rect = canvas.getBoundingClientRect();
569
+
570
+ // Calculate the touch position relative to the canvas
571
+ const touchX = touch.clientX - rect.left;
572
+ const touchY = touch.clientY - rect.top;
558
573
 
559
574
  if (touch.identifier !== touchId) {
560
575
  return;
@@ -347,7 +347,6 @@ export class DotBIMLoaderPlugin extends Plugin {
347
347
  const fileData = ctx.fileData;
348
348
  const sceneModel = ctx.sceneModel;
349
349
 
350
- const dbMeshIndices = {};
351
350
  const dbMeshLoaded = {};
352
351
 
353
352
  const ifcProjectId = math.createUUID();
@@ -385,17 +384,14 @@ export class DotBIMLoaderPlugin extends Plugin {
385
384
  propertySets: []
386
385
  };
387
386
 
388
- for (let i = 0, len = fileData.meshes.length; i < len; i++) {
389
- const dbMesh = fileData.meshes[i];
390
- dbMeshIndices[dbMesh.mesh_id] = i;
391
- }
392
-
393
- const parseDBMesh = (dbMeshId) => {
387
+ const parseDBMesh = (dbMeshId, element) => {
394
388
  if (dbMeshLoaded[dbMeshId]) {
395
389
  return;
396
390
  }
397
- const dbMeshIndex = dbMeshIndices[dbMeshId];
398
- const dbMesh = fileData.meshes[dbMeshIndex];
391
+
392
+ const dbMesh = fileData.meshes.find(obj => {
393
+ return obj.mesh_id === element.mesh_id;
394
+ });
399
395
  sceneModel.createGeometry({
400
396
  id: dbMeshId,
401
397
  primitive: "triangles",
@@ -434,7 +430,7 @@ export class DotBIMLoaderPlugin extends Plugin {
434
430
 
435
431
  if (element.face_colors === undefined) {
436
432
 
437
- parseDBMesh(dbMeshId);
433
+ parseDBMesh(dbMeshId, element);
438
434
 
439
435
  const meshId = `${objectId}-mesh`;
440
436
 
@@ -477,7 +473,9 @@ export class DotBIMLoaderPlugin extends Plugin {
477
473
  let faceColors = element.face_colors;
478
474
  let coloredTrianglesDictionary = {};
479
475
  let currentTriangleIndicesCount = 0;
480
- let dbMesh = fileData.meshes[element.mesh_id];
476
+ let dbMesh = fileData.meshes.find(obj => {
477
+ return obj.mesh_id === element.mesh_id;
478
+ });
481
479
  for (let i = 0, len = faceColors.length; i < len; i+=4) {
482
480
  let faceColor = [faceColors[i], faceColors[i+1], faceColors[i+2], faceColors[i+3]];
483
481
  if (coloredTrianglesDictionary[faceColor] === undefined) {
@@ -15,6 +15,7 @@ import {ParserV7} from "./parsers/ParserV7.js";
15
15
  import {ParserV8} from "./parsers/ParserV8.js";
16
16
  import {ParserV9} from "./parsers/ParserV9.js";
17
17
  import {ParserV10} from "./parsers/ParserV10.js";
18
+ import {ParserV11} from "./parsers/ParserV11.js";
18
19
 
19
20
 
20
21
  const parsers = {};
@@ -29,6 +30,7 @@ parsers[ParserV7.version] = ParserV7;
29
30
  parsers[ParserV8.version] = ParserV8;
30
31
  parsers[ParserV9.version] = ParserV9;
31
32
  parsers[ParserV10.version] = ParserV10;
33
+ parsers[ParserV11.version] = ParserV11;
32
34
 
33
35
  /**
34
36
  * {@link Viewer} plugin that loads models from xeokit's optimized *````.XKT````* format.
@@ -1146,6 +1148,12 @@ class XKTLoaderPlugin extends Plugin {
1146
1148
  return;
1147
1149
  }
1148
1150
  // this.log("Loading .xkt V" + xktVersion);
1151
+
1152
+ if (parser.parseArrayBuffer) {
1153
+ parser.parseArrayBuffer(this.viewer, options, arrayBuffer, sceneModel, metaModel, manifestCtx);
1154
+ return;
1155
+ }
1156
+
1149
1157
  const numElements = dataView.getUint32(4, true);
1150
1158
  const elements = [];
1151
1159
  let byteOffset = (numElements + 2) * 4;