@xeokit/xeokit-sdk 2.6.90 → 2.6.91
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/LICENSE +7 -4
- package/dist/xeokit-sdk.cjs.js +65332 -65340
- package/dist/xeokit-sdk.es.js +65332 -65340
- package/dist/xeokit-sdk.es5.js +4850 -4846
- package/dist/xeokit-sdk.min.cjs.js +7 -7
- package/dist/xeokit-sdk.min.es.js +7 -7
- package/dist/xeokit-sdk.min.es5.js +6 -6
- package/package.json +5 -5
- package/src/external.js +4 -0
- package/src/index.js +1 -1
- package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +2 -2
- package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +3 -3
- package/src/viewer/Viewer.js +1 -1
- package/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +1 -0
- package/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +9 -16
- package/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +11 -17
- package/types/viewer/Viewer.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xeokit/xeokit-sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.91",
|
|
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,10 +52,10 @@
|
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://xeokit.io",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@loaders.gl/core": "
|
|
56
|
-
"@loaders.gl/gltf": "
|
|
57
|
-
"@loaders.gl/las": "
|
|
58
|
-
"html2canvas": "
|
|
55
|
+
"@loaders.gl/core": "4.3.4",
|
|
56
|
+
"@loaders.gl/gltf": "4.3.4",
|
|
57
|
+
"@loaders.gl/las": "4.3.4",
|
|
58
|
+
"html2canvas": "1.4.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@babel/core": "^7.18.6",
|
package/src/external.js
ADDED
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { parse } from
|
|
2
|
-
import { GLTFLoader, postProcessGLTF } from
|
|
1
|
+
import { parse } from "../../external.js";
|
|
2
|
+
import { GLTFLoader, postProcessGLTF } from "../../external.js";
|
|
3
3
|
import { sRGBEncoding } from "../../viewer/scene/constants/constants.js";
|
|
4
4
|
import { core } from "../../viewer/scene/core.js";
|
|
5
5
|
import { math } from "../../viewer/scene/math/math.js";
|
|
@@ -3,9 +3,9 @@ import {SceneModel} from "../../viewer/scene/model/index.js";
|
|
|
3
3
|
import {Plugin} from "../../viewer/Plugin.js";
|
|
4
4
|
import {LASDefaultDataSource} from "./LASDefaultDataSource.js";
|
|
5
5
|
import {math} from "../../viewer/index.js";
|
|
6
|
-
import {parse} from
|
|
7
|
-
import {LASLoader} from
|
|
8
|
-
import {loadLASHeader} from "./loadLASHeader";
|
|
6
|
+
import {parse} from "../../external.js";
|
|
7
|
+
import {LASLoader} from "../../external.js";
|
|
8
|
+
import {loadLASHeader} from "./loadLASHeader.js";
|
|
9
9
|
|
|
10
10
|
const MAX_VERTICES = 500000; // TODO: Rough estimate
|
|
11
11
|
|
package/src/viewer/Viewer.js
CHANGED
|
@@ -3,7 +3,7 @@ import {CameraFlightAnimation} from "./scene/camera/CameraFlightAnimation.js";
|
|
|
3
3
|
import {CameraControl} from "./scene/CameraControl/CameraControl.js";
|
|
4
4
|
import {MetaScene} from "./metadata/MetaScene.js";
|
|
5
5
|
import {LocaleService} from "./localization/LocaleService.js";
|
|
6
|
-
import html2canvas from '
|
|
6
|
+
import {html2canvas} from '../external.js';
|
|
7
7
|
import {math} from "./scene/math/math.js";
|
|
8
8
|
import {transformToNode} from "../plugins/lib/ui/index.js";
|
|
9
9
|
|
|
@@ -20,6 +20,7 @@ class MouseMiscHandler {
|
|
|
20
20
|
|
|
21
21
|
document.addEventListener("mousemove", this._mouseMoveHandler = (e) => {
|
|
22
22
|
getCanvasPosFromEvent(e, canvas, states.pointerCanvasPos);
|
|
23
|
+
states.mouseover = true; // Added to fix XCD-386: The zoom speed slows down when zooming into an empty space for the first time on a relatively large model, and it cannot be reset without reloading
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
canvas.addEventListener("mousedown", this._mouseDownHandler = (e) => {
|
|
@@ -5,26 +5,15 @@ import {math} from "../../../math/math.js";
|
|
|
5
5
|
|
|
6
6
|
const canvasPos = math.vec2();
|
|
7
7
|
|
|
8
|
-
const getCanvasPosFromEvent = function
|
|
8
|
+
const getCanvasPosFromEvent = function(event, canvas, canvasPos) {
|
|
9
9
|
if (!event) {
|
|
10
10
|
event = window.event;
|
|
11
11
|
canvasPos[0] = event.x;
|
|
12
12
|
canvasPos[1] = event.y;
|
|
13
13
|
} else {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let totalScrollX = 0;
|
|
18
|
-
let totalScrollY = 0;
|
|
19
|
-
while (element.offsetParent) {
|
|
20
|
-
totalOffsetLeft += element.offsetLeft;
|
|
21
|
-
totalOffsetTop += element.offsetTop;
|
|
22
|
-
totalScrollX += element.scrollLeft;
|
|
23
|
-
totalScrollY += element.scrollTop;
|
|
24
|
-
element = element.offsetParent;
|
|
25
|
-
}
|
|
26
|
-
canvasPos[0] = event.pageX + totalScrollX - totalOffsetLeft;
|
|
27
|
-
canvasPos[1] = event.pageY + totalScrollY - totalOffsetTop;
|
|
14
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
15
|
+
canvasPos[0] = event.clientX - canvasRect.left;
|
|
16
|
+
canvasPos[1] = event.clientY - canvasRect.top;
|
|
28
17
|
}
|
|
29
18
|
return canvasPos;
|
|
30
19
|
};
|
|
@@ -296,7 +285,7 @@ class MousePanRotateDollyHandler {
|
|
|
296
285
|
}
|
|
297
286
|
switch (e.which) {
|
|
298
287
|
case 3: // Right button
|
|
299
|
-
getCanvasPosFromEvent(e, canvasPos);
|
|
288
|
+
getCanvasPosFromEvent(e, canvas, canvasPos);
|
|
300
289
|
const x = canvasPos[0];
|
|
301
290
|
const y = canvasPos[1];
|
|
302
291
|
if (Math.abs(x - lastXDown) < 3 && Math.abs(y - lastYDown) < 3) {
|
|
@@ -347,6 +336,10 @@ class MousePanRotateDollyHandler {
|
|
|
347
336
|
updates.dollyDelta += -normalizedDelta * secsElapsed * configs.mouseWheelDollyRate;
|
|
348
337
|
|
|
349
338
|
if (mouseMovedOnCanvasSinceLastWheel) {
|
|
339
|
+
if ((states.pointerCanvasPos[0] === 0) && (states.pointerCanvasPos[1] === 0)) {
|
|
340
|
+
// Dirty fix to initiate states.pointerCanvasPos if a wheel over an empty space is the first action in a scene
|
|
341
|
+
getCanvasPosFromEvent(e, canvas, states.pointerCanvasPos); // Added to fix XCD-386: The zoom speed slows down when zooming into an empty space for the first time on a relatively large model, and it cannot be reset without reloading
|
|
342
|
+
}
|
|
350
343
|
states.followPointerDirty = true;
|
|
351
344
|
mouseMovedOnCanvasSinceLastWheel = false;
|
|
352
345
|
}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import {math} from "../../../math/math.js";
|
|
2
2
|
|
|
3
|
-
const getCanvasPosFromEvent = function
|
|
3
|
+
const getCanvasPosFromEvent = function(event, canvas, canvasPos) {
|
|
4
4
|
if (!event) {
|
|
5
5
|
event = window.event;
|
|
6
6
|
canvasPos[0] = event.x;
|
|
7
7
|
canvasPos[1] = event.y;
|
|
8
8
|
} else {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
while (element.offsetParent) {
|
|
13
|
-
totalOffsetLeft += element.offsetLeft;
|
|
14
|
-
totalOffsetTop += element.offsetTop;
|
|
15
|
-
element = element.offsetParent;
|
|
16
|
-
}
|
|
17
|
-
canvasPos[0] = event.pageX - totalOffsetLeft;
|
|
18
|
-
canvasPos[1] = event.pageY - totalOffsetTop;
|
|
9
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
10
|
+
canvasPos[0] = event.clientX - canvasRect.left;
|
|
11
|
+
canvasPos[1] = event.clientY - canvasRect.top;
|
|
19
12
|
}
|
|
20
13
|
return canvasPos;
|
|
21
14
|
};
|
|
@@ -69,7 +62,7 @@ class TouchPanRotateAndDollyHandler {
|
|
|
69
62
|
|
|
70
63
|
tapStartTime = states.touchStartTime;
|
|
71
64
|
|
|
72
|
-
getCanvasPosFromEvent(touches[0], tapStartCanvasPos);
|
|
65
|
+
getCanvasPosFromEvent(touches[0], canvas, tapStartCanvasPos);
|
|
73
66
|
|
|
74
67
|
if (configs.followPointer) {
|
|
75
68
|
|
|
@@ -111,7 +104,7 @@ class TouchPanRotateAndDollyHandler {
|
|
|
111
104
|
}
|
|
112
105
|
|
|
113
106
|
for (let i = 0, len = touches.length; i < len; ++i) {
|
|
114
|
-
getCanvasPosFromEvent(touches[i], lastCanvasTouchPosList[i]);
|
|
107
|
+
getCanvasPosFromEvent(touches[i], canvas, lastCanvasTouchPosList[i]);
|
|
115
108
|
}
|
|
116
109
|
|
|
117
110
|
numTouches = touches.length;
|
|
@@ -159,7 +152,7 @@ class TouchPanRotateAndDollyHandler {
|
|
|
159
152
|
|
|
160
153
|
if (numTouches === 1) {
|
|
161
154
|
|
|
162
|
-
getCanvasPosFromEvent(touches[0], tapCanvasPos0);
|
|
155
|
+
getCanvasPosFromEvent(touches[0], canvas, tapCanvasPos0);
|
|
163
156
|
|
|
164
157
|
//-----------------------------------------------------------------------------------------------
|
|
165
158
|
// Drag rotation
|
|
@@ -220,8 +213,8 @@ class TouchPanRotateAndDollyHandler {
|
|
|
220
213
|
const touch0 = touches[0];
|
|
221
214
|
const touch1 = touches[1];
|
|
222
215
|
|
|
223
|
-
getCanvasPosFromEvent(touch0, tapCanvasPos0);
|
|
224
|
-
getCanvasPosFromEvent(touch1, tapCanvasPos1);
|
|
216
|
+
getCanvasPosFromEvent(touch0, canvas, tapCanvasPos0);
|
|
217
|
+
getCanvasPosFromEvent(touch1, canvas, tapCanvasPos1);
|
|
225
218
|
|
|
226
219
|
const lastMiddleTouch = math.geometricMeanVec2(lastCanvasTouchPosList[0], lastCanvasTouchPosList[1]);
|
|
227
220
|
const currentMiddleTouch = math.geometricMeanVec2(tapCanvasPos0, tapCanvasPos1);
|
|
@@ -243,6 +236,7 @@ class TouchPanRotateAndDollyHandler {
|
|
|
243
236
|
const dollyDelta = (d2 - d1) * configs.touchDollyRate;
|
|
244
237
|
|
|
245
238
|
updates.dollyDelta = dollyDelta;
|
|
239
|
+
states.followPointerDirty = true; // Added to fix XCD-386: The zoom speed slows down when zooming into an empty space for the first time on a relatively large model, and it cannot be reset without reloading
|
|
246
240
|
|
|
247
241
|
if (Math.abs(dollyDelta) < 1.0) {
|
|
248
242
|
|
|
@@ -269,7 +263,7 @@ class TouchPanRotateAndDollyHandler {
|
|
|
269
263
|
}
|
|
270
264
|
|
|
271
265
|
for (let i = 0; i < numTouches; ++i) {
|
|
272
|
-
getCanvasPosFromEvent(touches[i], lastCanvasTouchPosList[i]);
|
|
266
|
+
getCanvasPosFromEvent(touches[i], canvas, lastCanvasTouchPosList[i]);
|
|
273
267
|
}
|
|
274
268
|
});
|
|
275
269
|
}
|
package/types/viewer/Viewer.d.ts
CHANGED
|
@@ -51,8 +51,8 @@ export declare type ViewerConfiguration = {
|
|
|
51
51
|
alphaDepthMask?: boolean;
|
|
52
52
|
/** Whether to enable {@link Entity.offset}. For best performance, only set this ````true```` when you need to use {@link Entity.offset}. */
|
|
53
53
|
entityOffsetsEnabled?: boolean;
|
|
54
|
-
/** Whether to enable full-precision accuracy when surface picking with {@link Scene
|
|
55
|
-
|
|
54
|
+
/** Whether to enable full-precision accuracy when surface picking with {@link Scene#pick}. Note that when ````true````, this configuration will increase the amount of browser memory used by the Viewer. The ````pickSurfacePrecision```` option for ````Scene#pick```` only works if this is set ````true````. */
|
|
55
|
+
readableGeometryEnabled?: boolean;
|
|
56
56
|
/** Whether to enable logarithmic depth buffer. */
|
|
57
57
|
logarithmicDepthBufferEnabled?: boolean;
|
|
58
58
|
/** Whether to enable base color texture rendering. */
|