@xeokit/xeokit-sdk 2.5.2-beta-21 → 2.5.2-beta-23
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 +7 -5
- package/dist/xeokit-sdk.es.js +7 -5
- package/dist/xeokit-sdk.es5.js +4 -4
- package/dist/xeokit-sdk.min.cjs.js +2 -2
- package/dist/xeokit-sdk.min.es.js +2 -2
- package/dist/xeokit-sdk.min.es5.js +2 -2
- package/package.json +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +3 -3
- package/src/viewer/scene/geometry/builders/buildPolylineGeometry.js +87 -0
- package/src/viewer/scene/model/SceneModel.js +4 -2
- package/types/viewer/scene/geometry/builders/buildBoxLinesGeometry.d.ts +16 -1
- package/types/viewer/scene/geometry/builders/buildPolylineGeometry.d.ts +16 -0
package/package.json
CHANGED
|
@@ -223,8 +223,8 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
223
223
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
224
224
|
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
225
225
|
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
226
|
-
this.
|
|
227
|
-
this.
|
|
226
|
+
this.markerDiv.style.marginLeft = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
227
|
+
this.markerDiv.style.marginTop = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
228
228
|
break;
|
|
229
229
|
case MOUSE_FINDING_CORNER:
|
|
230
230
|
if (this._currentAngleMeasurement) {
|
|
@@ -387,7 +387,7 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
387
387
|
if (this.pointerLens) {
|
|
388
388
|
this.pointerLens.visible = false;
|
|
389
389
|
}
|
|
390
|
-
if (this.
|
|
390
|
+
if (this.markerDiv) {
|
|
391
391
|
this._destroyMarkerDiv()
|
|
392
392
|
}
|
|
393
393
|
this.reset();
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {utils} from '../../utils.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @desc Creates a 3D polyline {@link Geometry}.
|
|
5
|
+
*
|
|
6
|
+
* ## Usage
|
|
7
|
+
*
|
|
8
|
+
* In the example below we'll create a {@link Mesh} with a polyline {@link ReadableGeometry} that has lines primitives.
|
|
9
|
+
*
|
|
10
|
+
* [[Run this example](/examples/#geometry_builders_buildPolylineGeometry)]
|
|
11
|
+
*
|
|
12
|
+
* ````javascript
|
|
13
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
14
|
+
* // Import the modules we need for this example
|
|
15
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
16
|
+
*
|
|
17
|
+
* import {buildPolylineGeometry, Viewer, Mesh, ReadableGeometry, PhongMaterial} from "../../dist/xeokit-sdk.min.es.js";
|
|
18
|
+
*
|
|
19
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
20
|
+
* // Create a Viewer and arrange the camera
|
|
21
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
22
|
+
*
|
|
23
|
+
* const viewer = new Viewer({
|
|
24
|
+
* canvasId: "myCanvas"
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* viewer.camera.eye = [0, 0, 8];
|
|
28
|
+
* viewer.camera.look = [0, 0, 0];
|
|
29
|
+
* viewer.camera.up = [0, 1, 0];
|
|
30
|
+
*
|
|
31
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
32
|
+
* // Create a mesh with polyline shape
|
|
33
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
34
|
+
*
|
|
35
|
+
* new Mesh(viewer.scene, {
|
|
36
|
+
* geometry: new ReadableGeometry(viewer.scene, buildPolylineGeometry({
|
|
37
|
+
* points: [
|
|
38
|
+
* 0, 2.83654, 0,
|
|
39
|
+
* -0.665144, 1.152063, 0,
|
|
40
|
+
* -2.456516, 1.41827, 0,
|
|
41
|
+
* -1.330288, 0, 0,
|
|
42
|
+
* -2.456516, -1.41827, 0,
|
|
43
|
+
* -0.665144, -1.152063, 0,
|
|
44
|
+
* 0, -2.83654, 0,
|
|
45
|
+
* 0.665144, -1.152063, 0,
|
|
46
|
+
* 2.456516, -1.41827, 0,
|
|
47
|
+
* 1.330288, 0, 0,
|
|
48
|
+
* 2.456516, 1.41827, 0,
|
|
49
|
+
* 0.665144, 1.152063, 0,
|
|
50
|
+
* 0, 2.83654, 0,
|
|
51
|
+
* ]
|
|
52
|
+
* })),
|
|
53
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
54
|
+
* emissive: [0, 1,]
|
|
55
|
+
* })
|
|
56
|
+
* });
|
|
57
|
+
* ````
|
|
58
|
+
*
|
|
59
|
+
* @function buildPolylineGeometry
|
|
60
|
+
* @param {*} [cfg] Configs
|
|
61
|
+
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
|
62
|
+
* @param {Number[]} [cfg.points] 3D points indicating vertices position.
|
|
63
|
+
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
|
64
|
+
*/
|
|
65
|
+
function buildPolylineGeometry(cfg = {}) {
|
|
66
|
+
|
|
67
|
+
if (cfg.points.length % 3 !== 0) {
|
|
68
|
+
throw "Size of points array for given polyline should be divisible by 3";
|
|
69
|
+
}
|
|
70
|
+
let numberOfPoints = cfg.points.length / 3;
|
|
71
|
+
if (numberOfPoints < 2) {
|
|
72
|
+
throw "There should be at least 2 points to create a polyline";
|
|
73
|
+
}
|
|
74
|
+
let indices = [];
|
|
75
|
+
for (let i = 0; i < numberOfPoints - 1; i++) {
|
|
76
|
+
indices.push(i);
|
|
77
|
+
indices.push(i + 1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return utils.apply(cfg, {
|
|
81
|
+
primitive: "lines",
|
|
82
|
+
positions: cfg.points,
|
|
83
|
+
indices: indices,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export {buildPolylineGeometry};
|
|
@@ -2779,7 +2779,8 @@ export class SceneModel extends Component {
|
|
|
2779
2779
|
|
|
2780
2780
|
const useDTX = (!!this._dtxEnabled && (cfg.primitive === "triangles"
|
|
2781
2781
|
|| cfg.primitive === "solid"
|
|
2782
|
-
|| cfg.primitive === "surface"))
|
|
2782
|
+
|| cfg.primitive === "surface"))
|
|
2783
|
+
&& (!cfg.textureSetId);
|
|
2783
2784
|
|
|
2784
2785
|
cfg.origin = cfg.origin ? math.addVec3(this._origin, cfg.origin, math.vec3()) : this._origin;
|
|
2785
2786
|
|
|
@@ -2997,7 +2998,8 @@ export class SceneModel extends Component {
|
|
|
2997
2998
|
const useDTX = (!!this._dtxEnabled
|
|
2998
2999
|
&& (cfg.geometry.primitive === "triangles"
|
|
2999
3000
|
|| cfg.geometry.primitive === "solid"
|
|
3000
|
-
|| cfg.geometry.primitive === "surface"))
|
|
3001
|
+
|| cfg.geometry.primitive === "surface"))
|
|
3002
|
+
&& (!cfg.textureSetId);
|
|
3001
3003
|
|
|
3002
3004
|
if (useDTX) {
|
|
3003
3005
|
|
|
@@ -13,10 +13,25 @@ export declare type buildBoxLinesGeometryConfiguration = {
|
|
|
13
13
|
zSize?: number;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
export declare type buildBoxLinesGeometryFromAABBConfiguration = {
|
|
17
|
+
/* Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted. */
|
|
18
|
+
id?: string;
|
|
19
|
+
/* AABB for which box will be created. */
|
|
20
|
+
aabb?: number[];
|
|
21
|
+
};
|
|
22
|
+
|
|
16
23
|
/**
|
|
17
24
|
* @desc Creates a box-shaped lines {@link Geometry}.
|
|
18
25
|
*
|
|
19
26
|
* @param {buildBoxLinesGeometryConfiguration} [cfg] Configs
|
|
20
27
|
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
|
21
28
|
*/
|
|
22
|
-
export function buildBoxLinesGeometry(cfg: buildBoxLinesGeometryConfiguration): Geometry;
|
|
29
|
+
export function buildBoxLinesGeometry(cfg: buildBoxLinesGeometryConfiguration): Geometry;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @desc Creates a box-shaped lines {@link Geometry} from AABB.
|
|
33
|
+
*
|
|
34
|
+
* @param {buildBoxLinesGeometryConfiguration} [cfg] Configs
|
|
35
|
+
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
|
36
|
+
*/
|
|
37
|
+
export function buildBoxLinesGeometryFromAABB(cfg: buildBoxLinesGeometryFromAABBConfiguration): Geometry;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Geometry } from "../Geometry";
|
|
2
|
+
|
|
3
|
+
export declare type buildPolylineGeometryConfiguration = {
|
|
4
|
+
/* Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted. */
|
|
5
|
+
id?: string;
|
|
6
|
+
/* 3D points indicating vertices position. */
|
|
7
|
+
points?: number[];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @desc Creates a 3D polyline {@link Geometry}.
|
|
12
|
+
*
|
|
13
|
+
* @param {buildBoxLinesGeometryConfiguration} [cfg] Configs
|
|
14
|
+
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
|
15
|
+
*/
|
|
16
|
+
export function buildPolylineGeometry(cfg: buildPolylineGeometryConfiguration): Geometry;
|