@xeokit/xeokit-sdk 2.6.87 → 2.6.88
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/README.md +3 -3
- package/dist/xeokit-sdk.cjs.js +108 -4044
- package/dist/xeokit-sdk.es.js +108 -4044
- package/dist/xeokit-sdk.es5.js +170 -169
- package/dist/xeokit-sdk.min.cjs.js +8 -8
- package/dist/xeokit-sdk.min.es.js +7 -7
- package/dist/xeokit-sdk.min.es5.js +7 -7
- package/package.json +1 -2
- package/src/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.js +13 -2
- package/src/plugins/DotBIMLoaderPlugin/DotBIMLoaderPlugin.js +2 -2
- package/src/plugins/NavCubePlugin/NavCubePlugin.js +63 -22
- package/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +3 -1
- package/types/plugins/lib/ui/index.d.ts +7 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xeokit/xeokit-sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.88",
|
|
4
4
|
"description": "3D BIM IFC Viewer SDK for AEC engineering applications. Open Source JavaScript Toolkit based on pure WebGL for top performance, real-world coordinates and full double precision",
|
|
5
5
|
"module": "./dist/xeokit-sdk.es.js",
|
|
6
6
|
"main": "./dist/xeokit-sdk.cjs.js",
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://xeokit.io",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@creooxag/cxconverter": "^0.0.3-alpha",
|
|
56
55
|
"@loaders.gl/core": "^4.3.3",
|
|
57
56
|
"@loaders.gl/gltf": "^4.3.3",
|
|
58
57
|
"@loaders.gl/las": "^4.3.3",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "../../viewer/Plugin.js";
|
|
2
2
|
import { GLTFLoaderPlugin } from "../GLTFLoaderPlugin/GLTFLoaderPlugin.js";
|
|
3
|
-
import { ifc2gltf } from "@creooxag/cxconverter";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Fetches a file from the given URL and returns its contents as text.
|
|
@@ -51,6 +50,15 @@ class CxConverterIFCLoaderPlugin extends Plugin {
|
|
|
51
50
|
* @type {GLTFLoaderPlugin}
|
|
52
51
|
*/
|
|
53
52
|
this.gltfLoader = new GLTFLoaderPlugin(this.viewer);
|
|
53
|
+
this.cxConverterModule = null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Sets the CxConverter module to be used by this plugin.
|
|
58
|
+
* @param {Object} module The CxConverter module.
|
|
59
|
+
*/
|
|
60
|
+
setCxConverterModule(module) {
|
|
61
|
+
this.cxConverterModule = module;
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
/**
|
|
@@ -63,11 +71,14 @@ class CxConverterIFCLoaderPlugin extends Plugin {
|
|
|
63
71
|
* @returns {Promise<SceneModel>} A promise that resolves to the loaded SceneModel.
|
|
64
72
|
*/
|
|
65
73
|
async load(params = {}) {
|
|
74
|
+
if (!this.cxConverterModule) {
|
|
75
|
+
throw new Error("CxConverter module is not set. Use setCxConverterModule() to set it.");
|
|
76
|
+
}
|
|
66
77
|
if (!params.src) {
|
|
67
78
|
this.error("load() param expected: src");
|
|
68
79
|
}
|
|
69
80
|
const data = await fetchFile(params.src);
|
|
70
|
-
const { gltf, metaData } = await ifc2gltf(
|
|
81
|
+
const { gltf, metaData } = await this.cxConverterModule.ifc2gltf(
|
|
71
82
|
data,
|
|
72
83
|
{
|
|
73
84
|
remote: true,
|
|
@@ -432,7 +432,7 @@ export class DotBIMLoaderPlugin extends Plugin {
|
|
|
432
432
|
|
|
433
433
|
parseDBMesh(dbMeshId, element);
|
|
434
434
|
|
|
435
|
-
const meshId = `${objectId}-mesh`;
|
|
435
|
+
const meshId = `${objectId}-mesh-${dbMeshId}`;
|
|
436
436
|
|
|
437
437
|
let color = element.color ? [element.color.r / 255.0, element.color.g / 255.0, element.color.b / 255.0] : [1, 1, 1];
|
|
438
438
|
let opacity = element.color ? element.color.a / 255.0 : 1.0;
|
|
@@ -505,7 +505,7 @@ export class DotBIMLoaderPlugin extends Plugin {
|
|
|
505
505
|
positions: trianglesCoordinates,
|
|
506
506
|
indices: [...Array(trianglesCoordinates.length / 3).keys()]
|
|
507
507
|
});
|
|
508
|
-
const meshId = `${objectId}-mesh-${faceColor}`;
|
|
508
|
+
const meshId = `${objectId}-mesh-${dbMeshId}-${faceColor}`;
|
|
509
509
|
const faceColorArray = faceColor.split(',').map(Number);
|
|
510
510
|
|
|
511
511
|
let color = [faceColorArray[0] / 255.0, faceColorArray[1] / 255.0, faceColorArray[2] / 255.0];
|
|
@@ -295,25 +295,9 @@ class NavCubePlugin extends Plugin {
|
|
|
295
295
|
lastY = posY;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
function getCoordsWithinElement(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
event = window.event;
|
|
302
|
-
coords[0] = event.x;
|
|
303
|
-
coords[1] = event.y;
|
|
304
|
-
} else {
|
|
305
|
-
var element = event.target;
|
|
306
|
-
var totalOffsetLeft = 0;
|
|
307
|
-
var totalOffsetTop = 0;
|
|
308
|
-
while (element.offsetParent) {
|
|
309
|
-
totalOffsetLeft += element.offsetLeft;
|
|
310
|
-
totalOffsetTop += element.offsetTop;
|
|
311
|
-
element = element.offsetParent;
|
|
312
|
-
}
|
|
313
|
-
coords[0] = event.pageX - totalOffsetLeft;
|
|
314
|
-
coords[1] = event.pageY - totalOffsetTop;
|
|
315
|
-
}
|
|
316
|
-
return coords;
|
|
298
|
+
function getCoordsWithinElement(clientCoords) {
|
|
299
|
+
const { left, top } = self._navCubeCanvas.getBoundingClientRect();
|
|
300
|
+
return [clientCoords.clientX - left, clientCoords.clientY - top];
|
|
317
301
|
}
|
|
318
302
|
|
|
319
303
|
{
|
|
@@ -349,7 +333,7 @@ class NavCubePlugin extends Plugin {
|
|
|
349
333
|
downY = e.y;
|
|
350
334
|
lastX = e.clientX;
|
|
351
335
|
lastY = e.clientY;
|
|
352
|
-
var canvasPos = getCoordsWithinElement(e);
|
|
336
|
+
var canvasPos = getCoordsWithinElement({clientX: e.clientX, clientY: e.clientY});
|
|
353
337
|
var hit = navCubeScene.pick({
|
|
354
338
|
canvasPos: canvasPos
|
|
355
339
|
});
|
|
@@ -369,7 +353,7 @@ class NavCubePlugin extends Plugin {
|
|
|
369
353
|
if (downX === null) {
|
|
370
354
|
return;
|
|
371
355
|
}
|
|
372
|
-
var canvasPos = getCoordsWithinElement(e);
|
|
356
|
+
var canvasPos = getCoordsWithinElement({clientX: e.clientX, clientY: e.clientY});
|
|
373
357
|
var hit = navCubeScene.pick({
|
|
374
358
|
canvasPos: canvasPos,
|
|
375
359
|
pickSurface: true
|
|
@@ -442,7 +426,7 @@ class NavCubePlugin extends Plugin {
|
|
|
442
426
|
if (!over) {
|
|
443
427
|
return;
|
|
444
428
|
}
|
|
445
|
-
var canvasPos = getCoordsWithinElement(e);
|
|
429
|
+
var canvasPos = getCoordsWithinElement({clientX: e.clientX, clientY: e.clientY});
|
|
446
430
|
var hit = navCubeScene.pick({
|
|
447
431
|
canvasPos: canvasPos,
|
|
448
432
|
pickSurface: true
|
|
@@ -472,6 +456,55 @@ class NavCubePlugin extends Plugin {
|
|
|
472
456
|
}
|
|
473
457
|
}
|
|
474
458
|
});
|
|
459
|
+
|
|
460
|
+
self._navCubeCanvas.addEventListener("touchstart", self._onTouchStart = function (e) {
|
|
461
|
+
if (e.touches.length > 0) {
|
|
462
|
+
downX = e.touches[0].clientX;
|
|
463
|
+
downY = e.touches[0].clientY;
|
|
464
|
+
lastX = e.touches[0].clientX;
|
|
465
|
+
lastY = e.touches[0].clientY;
|
|
466
|
+
var canvasPos = getCoordsWithinElement({clientX: e.touches[0].clientX, clientY: e.touches[0].clientY});
|
|
467
|
+
var hit = navCubeScene.pick({
|
|
468
|
+
canvasPos: canvasPos
|
|
469
|
+
});
|
|
470
|
+
if (hit) {
|
|
471
|
+
down = true;
|
|
472
|
+
} else {
|
|
473
|
+
down = false;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
passive: false
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
self._navCubeCanvas.addEventListener("touchmove", self._onTouchMove = function (e) {
|
|
482
|
+
e.preventDefault();
|
|
483
|
+
var touch = e.touches[0];
|
|
484
|
+
var posX = touch.clientX;
|
|
485
|
+
var posY = touch.clientY;
|
|
486
|
+
|
|
487
|
+
var currentElement = document.elementFromPoint(posX, posY);
|
|
488
|
+
over = (self._navCubeCanvas === currentElement);
|
|
489
|
+
|
|
490
|
+
if (!over) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
if (down) {
|
|
494
|
+
actionMove(posX, posY);
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
passive: false
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
self._navCubeCanvas.addEventListener("touchend", self._onTouchEnd = function (e) {
|
|
503
|
+
down = false;
|
|
504
|
+
if (downX === null) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
});
|
|
475
508
|
|
|
476
509
|
var flyTo = (function () {
|
|
477
510
|
var center = math.vec3();
|
|
@@ -730,6 +763,10 @@ class NavCubePlugin extends Plugin {
|
|
|
730
763
|
this._navCubeCanvas.removeEventListener("mousemove", this._onMouseMove);
|
|
731
764
|
this._navCubeCanvas.removeEventListener("mouseup", this._onMouseUp);
|
|
732
765
|
|
|
766
|
+
this._navCubeCanvas.removeEventListener("touchstart", this._onTouchStart);
|
|
767
|
+
this._navCubeCanvas.removeEventListener("touchmove", this._onTouchMove);
|
|
768
|
+
this._navCubeCanvas.removeEventListener("touchend", this._onTouchEnd);
|
|
769
|
+
|
|
733
770
|
this._navCubeCanvas = null;
|
|
734
771
|
this._cubeTextureCanvas.destroy();
|
|
735
772
|
this._cubeTextureCanvas = null;
|
|
@@ -739,6 +776,10 @@ class NavCubePlugin extends Plugin {
|
|
|
739
776
|
this._onMouseDown = null;
|
|
740
777
|
this._onMouseMove = null;
|
|
741
778
|
this._onMouseUp = null;
|
|
779
|
+
|
|
780
|
+
this._onTouchStart = null;
|
|
781
|
+
this._onTouchMove = null;
|
|
782
|
+
this._onTouchEnd = null;
|
|
742
783
|
}
|
|
743
784
|
|
|
744
785
|
this._navCubeScene.destroy();
|
|
@@ -329,7 +329,8 @@ class SectionPlanesPlugin extends Plugin {
|
|
|
329
329
|
})(),
|
|
330
330
|
setQuaternion: q => { rootNode.quaternion = q; },
|
|
331
331
|
setScale: s => { rootNode.scale = s; },
|
|
332
|
-
setVisible: v => { rootNode.visible = v; }
|
|
332
|
+
setVisible: v => { rootNode.visible = v; },
|
|
333
|
+
destroy: () => { rootNode.destroy() }
|
|
333
334
|
};
|
|
334
335
|
})();
|
|
335
336
|
let unbindSectionPlane = () => { };
|
|
@@ -348,6 +349,7 @@ class SectionPlanesPlugin extends Plugin {
|
|
|
348
349
|
_destroy: () => {
|
|
349
350
|
unbindSectionPlane();
|
|
350
351
|
ctrl.destroy();
|
|
352
|
+
planeRoot.destroy();
|
|
351
353
|
},
|
|
352
354
|
setCulled: c => { culled = c; updateVisible(); },
|
|
353
355
|
setVisible: v => { visible = v; updateVisible(); },
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { Viewer } from "../../../viewer";
|
|
2
2
|
import { PointerCircle } from "../../../extras/PointerCircle";
|
|
3
3
|
|
|
4
|
+
type Vec2 = number[]
|
|
5
|
+
type Vec3 = number[]
|
|
6
|
+
type Ray2WorldPos<T> = (origin: Vec3, direction: Vec3) => T | null;
|
|
7
|
+
|
|
4
8
|
type Cleanup = () => void;
|
|
5
9
|
|
|
6
10
|
type OnCancel = () => void;
|
|
7
|
-
type OnChange = () => void;
|
|
8
|
-
type OnCommit = () => void;
|
|
11
|
+
type OnChange<T> = (canvasPos: Vec2, worldPos: T | null) => void;
|
|
12
|
+
type OnCommit<T> = (canvasPos: Vec2, worldPos: T | null) => void;
|
|
9
13
|
|
|
10
|
-
type Ray2WorldPos = (origin: number[], direction: number[]) => boolean | number[];
|
|
11
14
|
|
|
12
|
-
declare function touchPointSelector(viewer: Viewer, pointerCircle: PointerCircle, ray2WorldPos: Ray2WorldPos): (onCancel: OnCancel, onChange: OnChange
|
|
15
|
+
declare function touchPointSelector<T>(viewer: Viewer, pointerCircle: PointerCircle, ray2WorldPos: Ray2WorldPos<T>): (onCancel: OnCancel, onChange: OnChange<T>, onCommit: OnCommit<T>) => Cleanup;
|