@xeokit/xeokit-sdk 2.6.107 → 2.6.109
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/xeokit-sdk.cjs.js +110 -58
- package/dist/xeokit-sdk.es.js +110 -58
- package/dist/xeokit-sdk.es5.js +1575 -1563
- package/dist/xeokit-sdk.min.cjs.js +7 -7
- package/dist/xeokit-sdk.min.es.js +8 -8
- package/dist/xeokit-sdk.min.es5.js +6 -6
- package/package.json +7 -27
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +1 -1
- package/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +1 -1
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +1 -1
- package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +56 -20
- package/src/plugins/lib/ui/index.js +19 -4
- package/src/viewer/Viewer.js +1 -0
- package/src/viewer/metadata/MetaScene.js +14 -0
- package/src/viewer/scene/model/SceneModel.js +1 -1
- package/src/viewer/scene/model/layer/DTXLayer.js +0 -11
- package/src/viewer/scene/model/layer/Layer.js +1 -3
- package/src/viewer/scene/model/layer/VBOLayer.js +0 -1
- package/types/extras/index.d.ts +1 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.d.ts +1 -1
- package/types/plugins/AnnotationsPlugin/AnnotationsPlugin.d.ts +11 -6
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.d.ts +1 -1
- package/types/plugins/lib/ui/index.d.ts +8 -3
- package/types/viewer/Plugin.d.ts +8 -1
- package/types/viewer/scene/Entity.d.ts +19 -0
- package/types/viewer/scene/input/input.d.ts +1 -1
- package/types/viewer/scene/math/math.d.ts +30 -5
- package/types/viewer/scene/scene/Scene.d.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xeokit/xeokit-sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.109",
|
|
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",
|
|
@@ -8,21 +8,12 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "rollup --config rollup.config.js; rollup --config rollup.minified.config.js",
|
|
10
10
|
"dev-build": "rollup --config rollup.dev.config.js",
|
|
11
|
-
"docs": "rm -Rf ./docs/*; ./node_modules/.bin/esdoc && node docs/.scripts/fix-doc-links.mjs",
|
|
12
|
-
"typedocs": "rm -Rf ./docs/*; typedoc --tsconfig tsconfig.json",
|
|
13
|
-
"changelog": "git fetch; auto-changelog --commit-limit false --package --template changelog-template.hbs",
|
|
14
11
|
"test": "npx percy exec -- npx playwright test"
|
|
15
12
|
},
|
|
16
13
|
"repository": {
|
|
17
14
|
"type": "git",
|
|
18
15
|
"url": "https://github.com/xeokit/xeokit-sdk.git"
|
|
19
16
|
},
|
|
20
|
-
"auto-changelog": {
|
|
21
|
-
"output": "CHANGELOG.md",
|
|
22
|
-
"template": "keepachangelog",
|
|
23
|
-
"unreleased": true,
|
|
24
|
-
"commitLimit": false
|
|
25
|
-
},
|
|
26
17
|
"keywords": [
|
|
27
18
|
"ifc-viewer",
|
|
28
19
|
"bim-viewer",
|
|
@@ -58,27 +49,16 @@
|
|
|
58
49
|
"html2canvas": "1.4.1"
|
|
59
50
|
},
|
|
60
51
|
"devDependencies": {
|
|
61
|
-
"@babel/core": "^7.
|
|
62
|
-
"@babel/preset-env": "^7.
|
|
63
|
-
"@percy/cli": "^1.
|
|
64
|
-
"@percy/playwright": "^1.0
|
|
65
|
-
"@playwright/test": "^1.
|
|
52
|
+
"@babel/core": "^7.29.0",
|
|
53
|
+
"@babel/preset-env": "^7.29.2",
|
|
54
|
+
"@percy/cli": "^1.31.11",
|
|
55
|
+
"@percy/playwright": "^1.1.0",
|
|
56
|
+
"@playwright/test": "^1.59.1",
|
|
66
57
|
"@rollup/plugin-babel": "^5.3.1",
|
|
67
58
|
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
68
|
-
"@types/node": "^22.10.6",
|
|
69
|
-
"auto-changelog": "^2.4.0",
|
|
70
|
-
"dotenv": "^16.4.7",
|
|
71
|
-
"esdoc": "1.1.0",
|
|
72
|
-
"esdoc-custom-theme": "1.4.2",
|
|
73
|
-
"esdoc-ecmascript-proposal-plugin": "1.0.0",
|
|
74
|
-
"esdoc-publish-html-plugin": "1.1.2",
|
|
75
|
-
"esdoc-standard-plugin": "1.0.0",
|
|
76
|
-
"eslint": "^8.13.0",
|
|
77
|
-
"parse5": "^7.0.0",
|
|
78
59
|
"rollup": "^2.70.2",
|
|
79
60
|
"rollup-plugin-banner": "^0.2.1",
|
|
80
|
-
"rollup-plugin-terser": "^7.0.2"
|
|
81
|
-
"typedoc": "^0.22.15"
|
|
61
|
+
"rollup-plugin-terser": "^7.0.2"
|
|
82
62
|
},
|
|
83
63
|
"files": [
|
|
84
64
|
"/src",
|
|
@@ -251,7 +251,7 @@ export class AngleMeasurementsPlugin extends Plugin {
|
|
|
251
251
|
* @param {Viewer} viewer The Viewer.
|
|
252
252
|
* @param {Object} [cfg] Plugin configuration.
|
|
253
253
|
* @param {String} [cfg.id="AngleMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
254
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
254
|
+
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````, but different element should be specified to capture it with {@link Viewer.getSnapshotWithPlugins}.
|
|
255
255
|
* @param {string} [cfg.defaultColor=null] The default color of the dots, wire and label.
|
|
256
256
|
* @param {boolean} [cfg.defaultLabelsVisible=true] The default value of {@link AngleMeasurement.labelsVisible}.
|
|
257
257
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
@@ -375,7 +375,7 @@ class AnnotationsPlugin extends Plugin {
|
|
|
375
375
|
* @param {String} [cfg.id="Annotations"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
376
376
|
* @param {String} [cfg.markerHTML] HTML text template for Annotation markers. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````markerElementId````.
|
|
377
377
|
* @param {String} [cfg.labelHTML] HTML text template for Annotation labels. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````labelElementId````.
|
|
378
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
378
|
+
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````, but different element should be specified to capture it with {@link Viewer.getSnapshotWithPlugins}.
|
|
379
379
|
* @param {{String:(String|Number)}} [cfg.values={}] Map of default values to insert into the HTML templates for the marker and label.
|
|
380
380
|
* @param {Number} [cfg.surfaceOffset=0.3] The amount by which each {@link Annotation} is offset from the surface of
|
|
381
381
|
* its {@link Entity} when we create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin#createAnnotation}.
|
|
@@ -269,7 +269,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
269
269
|
* @param {Object} [cfg] Plugin configuration.
|
|
270
270
|
* @param {String} [cfg.id="DistanceMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
271
271
|
* @param {Number} [cfg.labelMinAxisLength=25] The minimum length, in pixels, of an axis wire beyond which its label is shown.
|
|
272
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
272
|
+
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````, but different element should be specified to capture it with {@link Viewer.getSnapshotWithPlugins}.
|
|
273
273
|
* @param {boolean} [cfg.defaultVisible=true] The default value of the DistanceMeasurements `visible` property.
|
|
274
274
|
* @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.
|
|
275
275
|
* @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
|
|
@@ -18,6 +18,13 @@ import {
|
|
|
18
18
|
RepeatWrapping
|
|
19
19
|
} from "../../viewer/scene/constants/constants.js";
|
|
20
20
|
|
|
21
|
+
const iota = n => {
|
|
22
|
+
const ret = [ ];
|
|
23
|
+
for (let i = 0; i < n; ++i)
|
|
24
|
+
ret.push(i);
|
|
25
|
+
return ret;
|
|
26
|
+
};
|
|
27
|
+
|
|
21
28
|
/**
|
|
22
29
|
* @private
|
|
23
30
|
*/
|
|
@@ -590,6 +597,51 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
|
|
|
590
597
|
meshCfg.color = new Float32Array([1.0, 1.0, 1.0]);
|
|
591
598
|
meshCfg.opacity = 1.0;
|
|
592
599
|
}
|
|
600
|
+
const POSITION = primitive.attributes.POSITION;
|
|
601
|
+
if (!POSITION) {
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
604
|
+
meshCfg.localPositions = POSITION.value;
|
|
605
|
+
meshCfg.positions = new Float64Array(meshCfg.localPositions.length);
|
|
606
|
+
if (primitive.attributes.NORMAL) {
|
|
607
|
+
meshCfg.normals = primitive.attributes.NORMAL.value;
|
|
608
|
+
}
|
|
609
|
+
if (primitive.attributes.TEXCOORD_0) {
|
|
610
|
+
meshCfg.uv = primitive.attributes.TEXCOORD_0.value;
|
|
611
|
+
}
|
|
612
|
+
if (primitive.indices) {
|
|
613
|
+
meshCfg.indices = primitive.indices.value;
|
|
614
|
+
}
|
|
615
|
+
if (matrix) {
|
|
616
|
+
math.transformPositions3(matrix, meshCfg.localPositions, meshCfg.positions);
|
|
617
|
+
} else { // eqiv to math.transformPositions3(math.identityMat4(), meshCfg.localPositions, meshCfg.positions);
|
|
618
|
+
meshCfg.positions.set(meshCfg.localPositions);
|
|
619
|
+
}
|
|
620
|
+
const linearize = closeLoop => {
|
|
621
|
+
const indices = meshCfg.indices || iota(meshCfg.localPositions.length / 3);
|
|
622
|
+
const len = indices.length;
|
|
623
|
+
const cnt = closeLoop ? len : (len - 1);
|
|
624
|
+
const linesIndices = new Uint32Array(cnt * 2);
|
|
625
|
+
for (let i = 0; i < cnt; ++i) {
|
|
626
|
+
const idx = i * 2;
|
|
627
|
+
linesIndices[idx] = indices[i];
|
|
628
|
+
linesIndices[idx+1] = indices[(i+1) % len];
|
|
629
|
+
}
|
|
630
|
+
meshCfg.indices = linesIndices;
|
|
631
|
+
};
|
|
632
|
+
const triangularize = getFirstPoint => {
|
|
633
|
+
const indices = meshCfg.indices || iota(meshCfg.localPositions.length / 3);
|
|
634
|
+
const len = indices.length;
|
|
635
|
+
const cnt = len - 2;
|
|
636
|
+
const trianglesIndices = new Uint32Array(cnt * 3);
|
|
637
|
+
for (let i = 0; i < cnt; ++i) {
|
|
638
|
+
const idx = i * 3;
|
|
639
|
+
trianglesIndices[idx] = getFirstPoint(indices, i);
|
|
640
|
+
trianglesIndices[idx+1] = indices[(i+1) % len];
|
|
641
|
+
trianglesIndices[idx+2] = indices[(i+2) % len];
|
|
642
|
+
}
|
|
643
|
+
meshCfg.indices = trianglesIndices;
|
|
644
|
+
};
|
|
593
645
|
const backfaces = ((ctx.backfaces !== false) || (material && material.doubleSided !== false));
|
|
594
646
|
switch (primitive.mode) {
|
|
595
647
|
case 0: // POINTS
|
|
@@ -600,42 +652,26 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
|
|
|
600
652
|
break;
|
|
601
653
|
case 2: // LINE_LOOP
|
|
602
654
|
meshCfg.primitive = "lines";
|
|
655
|
+
linearize(true);
|
|
603
656
|
break;
|
|
604
657
|
case 3: // LINE_STRIP
|
|
605
658
|
meshCfg.primitive = "lines";
|
|
659
|
+
linearize(false);
|
|
606
660
|
break;
|
|
607
661
|
case 4: // TRIANGLES
|
|
608
662
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
609
663
|
break;
|
|
610
664
|
case 5: // TRIANGLE_STRIP
|
|
611
665
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
666
|
+
triangularize((indices, i) => indices[i]);
|
|
612
667
|
break;
|
|
613
668
|
case 6: // TRIANGLE_FAN
|
|
614
669
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
670
|
+
triangularize((indices, i) => indices[0]);
|
|
615
671
|
break;
|
|
616
672
|
default:
|
|
617
673
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
618
674
|
}
|
|
619
|
-
const POSITION = primitive.attributes.POSITION;
|
|
620
|
-
if (!POSITION) {
|
|
621
|
-
continue;
|
|
622
|
-
}
|
|
623
|
-
meshCfg.localPositions = POSITION.value;
|
|
624
|
-
meshCfg.positions = new Float64Array(meshCfg.localPositions.length);
|
|
625
|
-
if (primitive.attributes.NORMAL) {
|
|
626
|
-
meshCfg.normals = primitive.attributes.NORMAL.value;
|
|
627
|
-
}
|
|
628
|
-
if (primitive.attributes.TEXCOORD_0) {
|
|
629
|
-
meshCfg.uv = primitive.attributes.TEXCOORD_0.value;
|
|
630
|
-
}
|
|
631
|
-
if (primitive.indices) {
|
|
632
|
-
meshCfg.indices = primitive.indices.value;
|
|
633
|
-
}
|
|
634
|
-
if (matrix) {
|
|
635
|
-
math.transformPositions3(matrix, meshCfg.localPositions, meshCfg.positions);
|
|
636
|
-
} else { // eqiv to math.transformPositions3(math.identityMat4(), meshCfg.localPositions, meshCfg.positions);
|
|
637
|
-
meshCfg.positions.set(meshCfg.localPositions);
|
|
638
|
-
}
|
|
639
675
|
const origin = math.vec3();
|
|
640
676
|
const rtcNeeded = worldToRTCPositions(meshCfg.positions, meshCfg.positions, origin); // Small cellsize guarantees better accuracy
|
|
641
677
|
if (rtcNeeded) {
|
|
@@ -312,10 +312,25 @@ export class Label3D {
|
|
|
312
312
|
this.__visible = true;
|
|
313
313
|
|
|
314
314
|
this._updatePos = () => {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
315
|
+
const p0 = tmpVec4a;
|
|
316
|
+
toClipSpace(camera, this._start, p0);
|
|
317
|
+
math.mulVec3Scalar(p0, 1.0 / p0[3]);
|
|
318
|
+
|
|
319
|
+
const outsideFrustum = ((p0[3] < 0)
|
|
320
|
+
||
|
|
321
|
+
(p0[0] < -1) || (p0[0] > 1)
|
|
322
|
+
||
|
|
323
|
+
(p0[1] < -1) || (p0[1] > 1)
|
|
324
|
+
||
|
|
325
|
+
(p0[2] < -1) || (p0[2] > 1));
|
|
326
|
+
const culled = outsideFrustum || scene._sectionPlanesState.sectionPlanes.some(
|
|
327
|
+
plane => plane.active && (math.dotVec3(plane.dir, math.subVec3(plane.pos, this._start, tmpVec3a)) > 0));
|
|
328
|
+
|
|
329
|
+
this._label.setCulled(culled);
|
|
330
|
+
if (! culled) {
|
|
331
|
+
toCanvasSpace(scene.canvas.canvas, parentElement, p0, tmpVec2a);
|
|
332
|
+
this._label.setPos(tmpVec2a[0], tmpVec2a[1]);
|
|
333
|
+
}
|
|
319
334
|
};
|
|
320
335
|
|
|
321
336
|
const setPosOnWire = (p0, p1, yOff) => {
|
package/src/viewer/Viewer.js
CHANGED
|
@@ -149,6 +149,20 @@ class MetaScene {
|
|
|
149
149
|
return metaModel;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Destroys this MetaScene.
|
|
154
|
+
*/
|
|
155
|
+
_destroy() {
|
|
156
|
+
this.viewer = null;
|
|
157
|
+
this.scene = null;
|
|
158
|
+
this.metaModels = {};
|
|
159
|
+
this.propertySets = {};
|
|
160
|
+
this.metaObjects = {};
|
|
161
|
+
this.metaObjectsByType = {};
|
|
162
|
+
this.rootMetaObjects = {};
|
|
163
|
+
this._eventSubs = {};
|
|
164
|
+
}
|
|
165
|
+
|
|
152
166
|
/**
|
|
153
167
|
* Removes a {@link MetaModel} from this MetaScene.
|
|
154
168
|
*
|
|
@@ -2998,7 +2998,7 @@ export class SceneModel extends Component {
|
|
|
2998
2998
|
const positionsDecodeHash = posDecode ? this._createHashStringFromMatrix(posDecode) : "-";
|
|
2999
2999
|
const textureSetId = cfg.textureSetId || "-";
|
|
3000
3000
|
const geometryId = instancing ? cfg.geometryId : "-";
|
|
3001
|
-
const layerId = (instancing ? "instancing" : "batching") + `.${Math.round(origin[0])}.${Math.round(origin[1])}.${Math.round(origin[2])}.${primitive}.${positionsDecodeHash}.${textureSetId}.${geometryId}`;
|
|
3001
|
+
const layerId = (instancing ? "instancing" : "batching") + `.${Math.round(origin[0])}.${Math.round(origin[1])}.${Math.round(origin[2])}.${primitive}.${positionsDecodeHash}.${textureSetId}.${geometryId}.${((cfg.normalsCompressed || cfg.normals || [ ]).length > 0) ? "n" : "-"}`;
|
|
3002
3002
|
|
|
3003
3003
|
if ((! instancing) && (layerId in this._vboLayers)) {
|
|
3004
3004
|
const layer = this._vboLayers[layerId];
|
|
@@ -586,17 +586,6 @@ export class DTXLayer extends Layer {
|
|
|
586
586
|
};
|
|
587
587
|
|
|
588
588
|
return {
|
|
589
|
-
edgesColorOpaqueAllowed: () => {
|
|
590
|
-
if (scene.logarithmicDepthBufferEnabled) {
|
|
591
|
-
if (!scene._loggedWarning) {
|
|
592
|
-
console.log("Edge enhancement for SceneModel data texture layers currently disabled with logarithmic depth buffer");
|
|
593
|
-
scene._loggedWarning = true;
|
|
594
|
-
}
|
|
595
|
-
return false;
|
|
596
|
-
} else {
|
|
597
|
-
return true;
|
|
598
|
-
}
|
|
599
|
-
},
|
|
600
589
|
sortId: sortId,
|
|
601
590
|
setClippableFlags: setFlags2,
|
|
602
591
|
setFlags: (portionId, flags, transparent, deferred = false) => {
|
|
@@ -617,9 +617,7 @@ export class Layer {
|
|
|
617
617
|
}
|
|
618
618
|
|
|
619
619
|
drawEdgesColorOpaque(renderFlags, frameCtx) {
|
|
620
|
-
|
|
621
|
-
this.__drawVertexEdges(renderFlags, frameCtx, RENDER_PASSES.EDGES_COLOR_OPAQUE);
|
|
622
|
-
}
|
|
620
|
+
this.__drawVertexEdges(renderFlags, frameCtx, RENDER_PASSES.EDGES_COLOR_OPAQUE);
|
|
623
621
|
}
|
|
624
622
|
|
|
625
623
|
drawEdgesColorTransparent(renderFlags, frameCtx) {
|
|
@@ -570,7 +570,6 @@ export class VBOLayer extends Layer {
|
|
|
570
570
|
|
|
571
571
|
const solid = (primitive === "solid");
|
|
572
572
|
return {
|
|
573
|
-
edgesColorOpaqueAllowed: () => true,
|
|
574
573
|
solid: solid,
|
|
575
574
|
sortId: (((primitive === "points") ? "Points" : ((primitive === "lines") ? "Lines" : "Triangles"))
|
|
576
575
|
+ (instancing ? "Instancing" : "Batching") + "Layer" +
|
package/types/extras/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare type AngleMeasurementsPluginConfiguration = {
|
|
|
7
7
|
/** Optional ID for this plugin, so that we can find it within {@link Viewer.plugins}. */
|
|
8
8
|
id?: string;
|
|
9
9
|
|
|
10
|
-
/** Container DOM element for markers and labels. Defaults to ````document.body
|
|
10
|
+
/** Container DOM element for markers and labels. Defaults to ````document.body````, but different element should be specified to capture it with {@link Viewer.getSnapshotWithPlugins}. */
|
|
11
11
|
container?: HTMLElement;
|
|
12
12
|
|
|
13
13
|
/** The default color of the dots, wire and label. */
|
|
@@ -9,7 +9,7 @@ export declare type AnnotationsPluginConfiguration = {
|
|
|
9
9
|
markerHTML?: string;
|
|
10
10
|
/** HTML text template for Annotation labels. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````labelElementId````. */
|
|
11
11
|
labelHTML?: string;
|
|
12
|
-
/** Container DOM element for markers and labels. Defaults to ````document.body
|
|
12
|
+
/** Container DOM element for markers and labels. Defaults to ````document.body````, but different element should be specified to capture it with {@link Viewer.getSnapshotWithPlugins}. */
|
|
13
13
|
container?: HTMLElement;
|
|
14
14
|
/** Map of default values to insert into the HTML templates for the marker and label. */
|
|
15
15
|
values?: { [key: string]: string | number };
|
|
@@ -117,34 +117,39 @@ export declare class AnnotationsPlugin extends Plugin {
|
|
|
117
117
|
* Fires when a annotation is created.
|
|
118
118
|
* @param {String} event The annotationCreated event
|
|
119
119
|
* @param {Function} callback Callback fired on the event
|
|
120
|
+
* @returns {String} Subscription id
|
|
120
121
|
*/
|
|
121
|
-
on(event: "annotationCreated", callback: (annotationId: string)=> void):
|
|
122
|
+
on(event: "annotationCreated", callback: (annotationId: string)=> void): string;
|
|
122
123
|
|
|
123
124
|
/**
|
|
124
125
|
* Fires when a annotation is destroyed.
|
|
125
126
|
* @param {String} event The annotationDestroyed event
|
|
126
127
|
* @param {Function} callback Callback fired on the event
|
|
128
|
+
* @returns {String} Subscription id
|
|
127
129
|
*/
|
|
128
|
-
on(event: "annotationDestroyed", callback: (annotationId: string)=> void):
|
|
130
|
+
on(event: "annotationDestroyed", callback: (annotationId: string)=> void): string;
|
|
129
131
|
|
|
130
132
|
/**
|
|
131
133
|
* Fires when a mouse enters a annotation.
|
|
132
134
|
* @param {String} event The markerMouseEnter event
|
|
133
135
|
* @param {Function} callback Callback fired on the event
|
|
136
|
+
* @returns {String} Subscription id
|
|
134
137
|
*/
|
|
135
|
-
on(event: "markerMouseEnter", callback: (annotation: Annotation)=> void):
|
|
138
|
+
on(event: "markerMouseEnter", callback: (annotation: Annotation)=> void): string;
|
|
136
139
|
|
|
137
140
|
/**
|
|
138
141
|
* Fires when a mouse leave an annotation.
|
|
139
142
|
* @param {String} event The markerMouseLeave event
|
|
140
143
|
* @param {Function} callback Callback fired on the event
|
|
144
|
+
* @returns {String} Subscription id
|
|
141
145
|
*/
|
|
142
|
-
on(event: "markerMouseLeave", callback: (annotation: Annotation)=> void):
|
|
146
|
+
on(event: "markerMouseLeave", callback: (annotation: Annotation)=> void): string;
|
|
143
147
|
|
|
144
148
|
/**
|
|
145
149
|
* Fires when a mouse leave an annotation.
|
|
146
150
|
* @param {String} event The markerClicked event
|
|
147
151
|
* @param {Function} callback Callback fired on the event
|
|
152
|
+
* @returns {String} Subscription id
|
|
148
153
|
*/
|
|
149
|
-
on(event: "markerClicked", callback: (annotation: Annotation)=> void):
|
|
154
|
+
on(event: "markerClicked", callback: (annotation: Annotation)=> void): string;
|
|
150
155
|
}
|
|
@@ -10,7 +10,7 @@ export declare type DistanceMeasurementsPluginConfiguration = {
|
|
|
10
10
|
/** The minimum length, in pixels, of an axis wire beyond which its label is shown. */
|
|
11
11
|
labelMinAxisLength?: number;
|
|
12
12
|
|
|
13
|
-
/** Container DOM element for markers and labels. Defaults to ````document.body
|
|
13
|
+
/** Container DOM element for markers and labels. Defaults to ````document.body````, but different element should be specified to capture it with {@link Viewer.getSnapshotWithPlugins}. */
|
|
14
14
|
container?: HTMLElement;
|
|
15
15
|
|
|
16
16
|
/** The default value of the DistanceMeasurements `visible` property. */
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Viewer } from "../../../viewer";
|
|
2
2
|
import { PointerCircle } from "../../../extras/PointerCircle";
|
|
3
|
+
import { CameraControl } from "../../../viewer/scene/CameraControl/CameraControl";
|
|
3
4
|
|
|
4
|
-
type Vec2 = number[]
|
|
5
|
-
type Vec3 = number[]
|
|
5
|
+
type Vec2 = number[];
|
|
6
|
+
type Vec3 = number[];
|
|
6
7
|
type Ray2WorldPos<T> = (origin: Vec3, direction: Vec3) => T | null;
|
|
7
8
|
|
|
8
9
|
type Cleanup = () => void;
|
|
@@ -12,4 +13,8 @@ type OnChange<T> = (canvasPos: Vec2, worldPos: T | null) => void;
|
|
|
12
13
|
type OnCommit<T> = (canvasPos: Vec2, worldPos: T | null) => void;
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
declare function touchPointSelector<T>(viewer: Viewer, pointerCircle: PointerCircle, ray2WorldPos: Ray2WorldPos<T>): (onCancel: OnCancel, onChange: OnChange<T>, onCommit: OnCommit<T>) => Cleanup;
|
|
16
|
+
declare function touchPointSelector<T>(viewer: Viewer, pointerCircle: PointerCircle, ray2WorldPos: Ray2WorldPos<T>): (onCancel: OnCancel, onChange: OnChange<T>, onCommit: OnCommit<T>) => Cleanup;
|
|
17
|
+
|
|
18
|
+
export declare function addMousePressListener(element: HTMLElement, onChange: (canvasPos: Vec2 | null) => void): Cleanup;
|
|
19
|
+
|
|
20
|
+
export declare function addTouchPressListener(element: HTMLElement, cameraControl: CameraControl, pointerCircle: PointerCircle, onChange: (canvasPos: Vec2 | null) => void): Cleanup;
|
package/types/viewer/Plugin.d.ts
CHANGED
|
@@ -31,8 +31,15 @@ export declare abstract class Plugin {
|
|
|
31
31
|
* Subscribes to an event fired at this Plugin.
|
|
32
32
|
* @param {String} event The event
|
|
33
33
|
* @param {Function} callback Callback fired on the event
|
|
34
|
+
* @returns {String} Subscription id
|
|
34
35
|
*/
|
|
35
|
-
on(event: string, callback: ()=> void):
|
|
36
|
+
on(event: string, callback: ()=> void): string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Removes event subscription.
|
|
40
|
+
* @param {String} subId Subscription id
|
|
41
|
+
*/
|
|
42
|
+
off(subId: string): void;
|
|
36
43
|
|
|
37
44
|
/**
|
|
38
45
|
* Fires an event at this Plugin.
|
|
@@ -14,6 +14,15 @@ export declare abstract class Entity {
|
|
|
14
14
|
*/
|
|
15
15
|
get id(): string | number;
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* The SceneModel of the SceneModelEntity
|
|
19
|
+
*
|
|
20
|
+
* SceneModelEntity is the only Entity class at the moment, so every Entity is SceneModelEntity.
|
|
21
|
+
*/
|
|
22
|
+
model: {
|
|
23
|
+
id?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
/**
|
|
18
27
|
* ID of the corresponding object within the originating system, if any.
|
|
19
28
|
*
|
|
@@ -399,6 +408,16 @@ export declare abstract class Entity {
|
|
|
399
408
|
*/
|
|
400
409
|
getGeometryData(): {indices: number[],positions:number[]}
|
|
401
410
|
|
|
411
|
+
/**
|
|
412
|
+
* Gets volume of the entity.
|
|
413
|
+
*/
|
|
414
|
+
get volume(): number;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Gets surface area of the entity.
|
|
418
|
+
*/
|
|
419
|
+
get surfaceArea(): number;
|
|
420
|
+
|
|
402
421
|
/**
|
|
403
422
|
* Destroys this Entity.
|
|
404
423
|
*/
|
|
@@ -153,7 +153,7 @@ export declare class Input extends Component {
|
|
|
153
153
|
* @param callback Called fired on the event
|
|
154
154
|
* @param scope Scope for the callback
|
|
155
155
|
*/
|
|
156
|
-
on(event: "mousedown" | "mouseup" | "mouseclicked" | "dblclick", callback: (canvasCoords: number[]) => void, scope?: any): string;
|
|
156
|
+
on(event: "mousedown" | "mouseup" | "mouseclicked" | "dblclick" | "mousemove", callback: (canvasCoords: number[]) => void, scope?: any): string;
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
159
|
* Fires on keyboard events
|
|
@@ -50,12 +50,37 @@ declare const math: {
|
|
|
50
50
|
/**
|
|
51
51
|
* Normalizes a three-element vector
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
normalizeVec3: (v: number[], dest?: any) => number[];
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Adds one three-element vector to another.
|
|
57
|
+
*/
|
|
58
|
+
addVec3: (u: number[], v: number[], dest?: number[]) => number[];
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Adds one three-element vector to another.
|
|
62
|
+
*/
|
|
63
|
+
subVec3: (u: number[], v: number[], dest?: number[]) => number[];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Multiplies each element of a three-element vector by a scalar.
|
|
67
|
+
*/
|
|
68
|
+
mulVec3Scalar: (v: number[], scalar: number, dest?: number[]) => number[];
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Returns the cross product of two three-element vectors.
|
|
72
|
+
*/
|
|
73
|
+
cross3Vec3: (u: number[], v: number[], dest?: number[]) => number[];
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Multiplies the given 4x4 matrix by the given four-element vector.
|
|
77
|
+
*/
|
|
78
|
+
mulMat4v4: (m: number[], v: number[], dest?: number[]) => number[];
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Builds normal vectors from positions and indices.
|
|
82
|
+
*/
|
|
83
|
+
buildNormals: (positions: number[], indices: number[], normals?: number) => number[];
|
|
59
84
|
};
|
|
60
85
|
|
|
61
86
|
export {math};
|
|
@@ -89,6 +89,8 @@ export declare class Scene extends Component {
|
|
|
89
89
|
*/
|
|
90
90
|
on(event: "sectionPlaneDestroyed", callback: (measurement: SectionPlane) => void): void;
|
|
91
91
|
|
|
92
|
+
canvas: Component;
|
|
93
|
+
|
|
92
94
|
/**
|
|
93
95
|
* The epoch time (in milliseconds since 1970) when this Scene was instantiated.
|
|
94
96
|
*/
|
|
@@ -715,6 +717,9 @@ export declare class Scene extends Component {
|
|
|
715
717
|
* @param {Number[]} [params.origin] World-space ray origin when ray-picking. Ignored when canvasPos given.
|
|
716
718
|
* @param {Number[]} [params.direction] World-space ray direction when ray-picking. Also indicates the length of the ray. Ignored when canvasPos given.
|
|
717
719
|
* @param {Number[]} [params.matrix] 4x4 transformation matrix to define the World-space ray origin and direction, as an alternative to ````origin```` and ````direction````.
|
|
720
|
+
* @param {Number} [params.snapRadius=30] The snap radius, in canvas pixels.
|
|
721
|
+
* @param {boolean} [params.snapToEdge=true] Whether to snap to edge. Only works when `canvasPos` given.
|
|
722
|
+
* @param {boolean} [params.snapToVertex=true] Whether to snap to vertex. Only works when `canvasPos` given.
|
|
718
723
|
* @param {String[]} [params.includeEntities] IDs of {@link Entity}s to restrict picking to. When given, ignores {@link Entity}s whose IDs are not in this list.
|
|
719
724
|
* @param {String[]} [params.excludeEntities] IDs of {@link Entity}s to ignore. When given, will pick *through* these {@link Entity}s, as if they were not there.
|
|
720
725
|
* @param {PickResult} [pickResult] Holds the results of the pick attempt. Will use the Scene's singleton PickResult if you don't supply your own.
|
|
@@ -728,6 +733,9 @@ export declare class Scene extends Component {
|
|
|
728
733
|
origin?: number[];
|
|
729
734
|
direction?: number[];
|
|
730
735
|
matrix?: number[];
|
|
736
|
+
snapRadius?: number;
|
|
737
|
+
snapToEdge?: boolean;
|
|
738
|
+
snapToVertex?: boolean;
|
|
731
739
|
includeEntities?: string[];
|
|
732
740
|
excludeEntities?: string[];
|
|
733
741
|
}, pickResult?: PickResult): PickResult | null;
|