@xeokit/xeokit-sdk 2.6.73 → 2.6.75
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 +221 -108
- package/dist/xeokit-sdk.es.js +221 -108
- package/dist/xeokit-sdk.es5.js +311 -301
- package/dist/xeokit-sdk.min.cjs.js +6 -6
- package/dist/xeokit-sdk.min.es.js +7 -7
- package/dist/xeokit-sdk.min.es5.js +6 -6
- package/package.json +1 -1
- package/src/extras/ContextMenu/ContextMenu.js +25 -16
- package/src/plugins/FastNavPlugin/FastNavPlugin.js +10 -0
- package/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +24 -49
- package/src/plugins/TreeViewPlugin/RenderService.js +13 -4
- package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +1 -1
- package/src/viewer/Viewer.js +0 -16
- package/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +29 -8
- package/src/viewer/scene/LineSet/LineSet.js +7 -2
- package/src/viewer/scene/skybox/Skybox.js +110 -9
- package/types/plugins/SkyboxesPlugin/SkyboxesPlugin.d.ts +18 -4
- package/types/viewer/scene/CameraControl/CameraControl.d.ts +168 -0
- package/types/viewer/scene/LineSet/LineSet.d.ts +1 -1
- package/types/viewer/scene/camera/CameraPath.d.ts +86 -6
- package/types/viewer/scene/camera/CameraPathAnimation.d.ts +2 -0
- package/types/viewer/scene/geometry/ReadableGeometry.d.ts +14 -0
- package/types/viewer/scene/geometry/VBOGeometry.d.ts +2 -0
- package/types/viewer/scene/geometry/index.d.ts +2 -1
- package/types/viewer/scene/geometry/loaders/index.d.ts +2 -0
- package/types/viewer/scene/geometry/loaders/load3DSGeometry.d.ts +17 -0
- package/types/viewer/scene/geometry/loaders/loadOBJGeometry.d.ts +18 -0
- package/types/viewer/scene/index.d.ts +2 -0
- package/types/viewer/scene/input/input.d.ts +117 -0
- package/types/viewer/scene/lights/AmbientLight.d.ts +41 -0
- package/types/viewer/scene/lights/CubeTexture.d.ts +27 -0
- package/types/viewer/scene/lights/DirLight.d.ts +77 -0
- package/types/viewer/scene/lights/LightMap.d.ts +27 -0
- package/types/viewer/scene/lights/PointLight.d.ts +135 -0
- package/types/viewer/scene/lights/ReflectionMap.d.ts +26 -0
- package/types/viewer/scene/lights/index.d.ts +4 -1
- package/types/viewer/scene/marker/Marker.d.ts +5 -0
- package/types/viewer/scene/materials/EmphasisMaterial.d.ts +5 -0
- package/types/viewer/scene/materials/Fresnel.d.ts +25 -62
- package/types/viewer/scene/materials/LambertMaterial.d.ts +192 -0
- package/types/viewer/scene/materials/MetallicMaterial.d.ts +359 -0
- package/types/viewer/scene/materials/PhongMaterial.d.ts +5 -0
- package/types/viewer/scene/materials/PointsMaterial.d.ts +5 -0
- package/types/viewer/scene/materials/SpecularMaterial.d.ts +342 -0
- package/types/viewer/scene/materials/Texture.d.ts +36 -78
- package/types/viewer/scene/materials/index.d.ts +2 -0
- package/types/viewer/scene/models/SceneModel.d.ts +134 -7
- package/types/viewer/scene/models/SceneModelEntity.d.ts +65 -0
- package/types/viewer/scene/models/SceneModelMesh.d.ts +12 -0
- package/types/viewer/scene/paths/CubicBezierCurve.d.ts +146 -0
- package/types/viewer/scene/paths/Curve.d.ts +75 -0
- package/types/viewer/scene/paths/Path.d.ts +119 -0
- package/types/viewer/scene/paths/QuadraticBezierCurve.d.ts +124 -0
- package/types/viewer/scene/paths/SplineCurve.d.ts +84 -0
- package/types/viewer/scene/paths/index.d.ts +5 -0
- package/types/viewer/scene/scene/Scene.d.ts +102 -0
- package/types/viewer/scene/sectionPlane/SectionPlane.d.ts +41 -0
- package/types/viewer/scene/skybox/Skybox.d.ts +59 -0
- package/types/viewer/scene/skybox/index.d.ts +1 -0
- package/types/viewer/scene/webgl/PickResult.d.ts +19 -0
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* xeokit-sdk v2.6.
|
|
3
|
-
* Commit:
|
|
4
|
-
* Built: 2025-04-
|
|
2
|
+
* xeokit-sdk v2.6.75
|
|
3
|
+
* Commit: c9b6b9ca6ba5bea44b4e84678d4f9ffbf152086d
|
|
4
|
+
* Built: 2025-04-17T10:44:28.149Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
@@ -350,7 +350,8 @@ class ContextMenu {
|
|
|
350
350
|
this._shown = false; // True when the ContextMenu is visible
|
|
351
351
|
this._nextId = 0;
|
|
352
352
|
this._parentNode = cfg.parentNode || document.body;
|
|
353
|
-
|
|
353
|
+
this._offsetParent = (this._parentNode instanceof ShadowRoot) ? this._parentNode.host : this._parentNode;
|
|
354
|
+
|
|
354
355
|
/**
|
|
355
356
|
* Subscriptions to events fired at this ContextMenu.
|
|
356
357
|
* @private
|
|
@@ -562,7 +563,7 @@ class ContextMenu {
|
|
|
562
563
|
for (let i = 0, len = this._menuList.length; i < len; i++) {
|
|
563
564
|
const menu = this._menuList[i];
|
|
564
565
|
const menuElement = menu.menuElement;
|
|
565
|
-
menuElement.
|
|
566
|
+
menuElement.remove();
|
|
566
567
|
}
|
|
567
568
|
this._itemsCfg = [];
|
|
568
569
|
this._rootMenu = null;
|
|
@@ -790,21 +791,22 @@ class ContextMenu {
|
|
|
790
791
|
|
|
791
792
|
const itemRect = itemElement.getBoundingClientRect();
|
|
792
793
|
subMenuElement.getBoundingClientRect();
|
|
794
|
+
const offsetRect = self._offsetParent.getBoundingClientRect();
|
|
793
795
|
|
|
794
796
|
const subMenuWidth = 200; // TODO
|
|
795
|
-
const showOnRight = (itemRect.right + subMenuWidth) <
|
|
796
|
-
const showOnLeft = (itemRect.left - subMenuWidth) >
|
|
797
|
-
|
|
797
|
+
const showOnRight = (itemRect.right + subMenuWidth) < offsetRect.right;
|
|
798
|
+
const showOnLeft = (itemRect.left - subMenuWidth) > offsetRect.left;
|
|
799
|
+
|
|
798
800
|
if(showOnRight)
|
|
799
|
-
self._showMenu(subMenu.id, itemRect.right - 5, itemRect.top - 1);
|
|
801
|
+
self._showMenu(subMenu.id, itemRect.right + window.scrollX - 5, itemRect.top + window.scrollY - 1);
|
|
800
802
|
else if (showOnLeft)
|
|
801
|
-
self._showMenu(subMenu.id, itemRect.left - subMenuWidth, itemRect.top - 1);
|
|
803
|
+
self._showMenu(subMenu.id, itemRect.left - subMenuWidth + window.scrollX, itemRect.top + window.scrollY - 1);
|
|
802
804
|
else {
|
|
803
|
-
const spaceOnLeft = itemRect.left, spaceOnRight =
|
|
805
|
+
const spaceOnLeft = itemRect.left - offsetRect.left, spaceOnRight = offsetRect.right - itemRect.right;
|
|
804
806
|
if(spaceOnRight > spaceOnLeft)
|
|
805
|
-
self._showMenu(subMenu.id, itemRect.right - 5 - (subMenuWidth - spaceOnRight), itemRect.top - 1);
|
|
807
|
+
self._showMenu(subMenu.id, itemRect.right - 5 - (subMenuWidth - spaceOnRight), itemRect.top + window.scrollY - 1);
|
|
806
808
|
else
|
|
807
|
-
self._showMenu(subMenu.id, itemRect.left - spaceOnLeft, itemRect.top - 1);
|
|
809
|
+
self._showMenu(subMenu.id, itemRect.left - spaceOnLeft, itemRect.top + window.scrollY - 1);
|
|
808
810
|
}
|
|
809
811
|
|
|
810
812
|
lastSubMenu = subMenu;
|
|
@@ -997,14 +999,21 @@ class ContextMenu {
|
|
|
997
999
|
menuElement.style.display = 'block';
|
|
998
1000
|
const menuHeight = menuElement.offsetHeight;
|
|
999
1001
|
const menuWidth = menuElement.offsetWidth;
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
+
|
|
1003
|
+
const offsetRect = this._offsetParent.getBoundingClientRect();
|
|
1004
|
+
|
|
1005
|
+
const bottomContainerBorder = offsetRect.bottom + window.scrollY;
|
|
1006
|
+
const rightContainerBorder = offsetRect.right + window.scrollX;
|
|
1007
|
+
if ((pageY + menuHeight) > bottomContainerBorder) {
|
|
1008
|
+
pageY = bottomContainerBorder- menuHeight;
|
|
1002
1009
|
}
|
|
1003
|
-
if ((pageX + menuWidth) >
|
|
1004
|
-
pageX =
|
|
1010
|
+
if ((pageX + menuWidth) > rightContainerBorder) {
|
|
1011
|
+
pageX = rightContainerBorder - menuWidth;
|
|
1005
1012
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1013
|
+
|
|
1014
|
+
|
|
1015
|
+
menuElement.style.left = pageX - offsetRect.left - window.scrollX + 'px';
|
|
1016
|
+
menuElement.style.top = pageY - offsetRect.top - window.scrollY + 'px';
|
|
1008
1017
|
}
|
|
1009
1018
|
|
|
1010
1019
|
_hideMenuElement(menuElement) {
|
|
@@ -89183,7 +89192,7 @@ class LineSet extends Component {
|
|
|
89183
89192
|
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
|
89184
89193
|
* @param {Number[]} cfg.positions World-space 3D vertex positions.
|
|
89185
89194
|
* @param {Number[]} [cfg.indices] Indices to connect ````positions```` into line segments. Note that these are separate line segments, not a polyline.
|
|
89186
|
-
* @param {Number[]} [cfg.color=[
|
|
89195
|
+
* @param {Number[]} [cfg.color=[1,1,1]] The color of this ````LineSet````. This is both emissive and diffuse.
|
|
89187
89196
|
* @param {Boolean} [cfg.visible=true] Indicates whether or not this ````LineSet```` is visible.
|
|
89188
89197
|
* @param {Number} [cfg.opacity=1.0] ````LineSet````'s initial opacity factor.
|
|
89189
89198
|
*/
|
|
@@ -89203,6 +89212,9 @@ class LineSet extends Component {
|
|
|
89203
89212
|
}
|
|
89204
89213
|
}
|
|
89205
89214
|
|
|
89215
|
+
this._color = cfg.color || [1, 1, 1];
|
|
89216
|
+
this._opacity = cfg.opacity || 1.0;
|
|
89217
|
+
|
|
89206
89218
|
this._sceneModel = new SceneModel(this, {
|
|
89207
89219
|
isModel: false // Don't register in Scene.models
|
|
89208
89220
|
});
|
|
@@ -89211,7 +89223,9 @@ class LineSet extends Component {
|
|
|
89211
89223
|
id: "linesMesh",
|
|
89212
89224
|
primitive: "lines",
|
|
89213
89225
|
positions: this._positions,
|
|
89214
|
-
indices: this._indices
|
|
89226
|
+
indices: this._indices,
|
|
89227
|
+
color: this._color,
|
|
89228
|
+
opacity: this._opacity,
|
|
89215
89229
|
});
|
|
89216
89230
|
|
|
89217
89231
|
this._sceneModel.createEntity({
|
|
@@ -92939,6 +92953,7 @@ class FastNavPlugin extends Plugin {
|
|
|
92939
92953
|
* @param {Number} [cfg.scaleCanvasResolutionFactor=0.6] The factor by which we downscale the canvas resolution whenever we interact with the Viewer.
|
|
92940
92954
|
* @param {Boolean} [cfg.delayBeforeRestore=true] Whether to temporarily have a delay before restoring normal rendering after we stop interacting with the Viewer.
|
|
92941
92955
|
* @param {Number} [cfg.delayBeforeRestoreSeconds=0.5] Delay in seconds before restoring normal rendering after we stop interacting with the Viewer.
|
|
92956
|
+
* @param {Function} [cfg.onMoved] Optional callback function fired during moving mode, should return the callback function that will be fired when the interaction stops.
|
|
92942
92957
|
*/
|
|
92943
92958
|
constructor(viewer, cfg = {}) {
|
|
92944
92959
|
|
|
@@ -92954,6 +92969,8 @@ class FastNavPlugin extends Plugin {
|
|
|
92954
92969
|
this._scaleCanvasResolutionFactor = cfg.scaleCanvasResolutionFactor || 0.6;
|
|
92955
92970
|
this._delayBeforeRestore = (cfg.delayBeforeRestore !== false);
|
|
92956
92971
|
this._delayBeforeRestoreSeconds = cfg.delayBeforeRestoreSeconds || 0.5;
|
|
92972
|
+
this._onMoved = cfg.onMoved;
|
|
92973
|
+
this._onStopped = null;
|
|
92957
92974
|
|
|
92958
92975
|
let timer = this._delayBeforeRestoreSeconds * 1000;
|
|
92959
92976
|
let fastMode = false;
|
|
@@ -92972,6 +92989,10 @@ class FastNavPlugin extends Plugin {
|
|
|
92972
92989
|
} else {
|
|
92973
92990
|
viewer.scene.canvas.resolutionScale = this._defaultScaleCanvasResolutionFactor;
|
|
92974
92991
|
}
|
|
92992
|
+
if (this._onMoved) {
|
|
92993
|
+
this._onStopped = this._onMoved();
|
|
92994
|
+
}
|
|
92995
|
+
|
|
92975
92996
|
fastMode = true;
|
|
92976
92997
|
}
|
|
92977
92998
|
};
|
|
@@ -92983,6 +93004,9 @@ class FastNavPlugin extends Plugin {
|
|
|
92983
93004
|
viewer.scene._renderer.setPBREnabled(true);
|
|
92984
93005
|
viewer.scene._renderer.setSAOEnabled(true);
|
|
92985
93006
|
viewer.scene._renderer.setTransparentEnabled(true);
|
|
93007
|
+
if (this._onStopped) {
|
|
93008
|
+
this._onStopped();
|
|
93009
|
+
}
|
|
92986
93010
|
fastMode = false;
|
|
92987
93011
|
};
|
|
92988
93012
|
|
|
@@ -98309,8 +98333,8 @@ class Skybox extends Component {
|
|
|
98309
98333
|
* @param {Component} owner Owner component. When destroyed, the owner will destroy this PointLight as well.
|
|
98310
98334
|
* @param {*} [cfg] Skybox configuration
|
|
98311
98335
|
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {Scene}, generated automatically when omitted.
|
|
98312
|
-
* @param {String} [cfg.src=null] Path to skybox texture
|
|
98313
|
-
* @param {
|
|
98336
|
+
* @param {String | String[]} [cfg.src=null] Path to skybox texture
|
|
98337
|
+
* @param {Number} [cfg.encoding=LinearEncoding] Texture encoding format. See the {@link Texture#encoding} property for more info.
|
|
98314
98338
|
* @param {Number} [cfg.size=1000] Size of this Skybox, given as the distance from the center at ````[0,0,0]```` to each face.
|
|
98315
98339
|
* @param {Boolean} [cfg.active=true] True when this Skybox is visible.
|
|
98316
98340
|
*/
|
|
@@ -98318,6 +98342,32 @@ class Skybox extends Component {
|
|
|
98318
98342
|
|
|
98319
98343
|
super(owner, cfg);
|
|
98320
98344
|
|
|
98345
|
+
const useMultipleTexture = typeof cfg.src === "object" && cfg.src !== null;
|
|
98346
|
+
|
|
98347
|
+
if (useMultipleTexture) {
|
|
98348
|
+
this._createCombinedTexture(cfg).then(combinedTexture => {
|
|
98349
|
+
this._createSkyboxMesh(cfg, combinedTexture);
|
|
98350
|
+
}).catch(e => this.error(e));
|
|
98351
|
+
} else {
|
|
98352
|
+
this._createSkyboxMesh(cfg);
|
|
98353
|
+
}
|
|
98354
|
+
}
|
|
98355
|
+
|
|
98356
|
+
/**
|
|
98357
|
+
*
|
|
98358
|
+
* @private
|
|
98359
|
+
* @param {*} cfg
|
|
98360
|
+
* @param {Texture} combinedTexture
|
|
98361
|
+
*/
|
|
98362
|
+
_createSkyboxMesh(cfg, combinedTexture = null) {
|
|
98363
|
+
const texture = combinedTexture || new Texture(this, {
|
|
98364
|
+
src: cfg.src,
|
|
98365
|
+
flipY: true,
|
|
98366
|
+
wrapS: ClampToEdgeWrapping,
|
|
98367
|
+
wrapT: ClampToEdgeWrapping,
|
|
98368
|
+
encoding: cfg.encoding || LinearEncoding
|
|
98369
|
+
});
|
|
98370
|
+
|
|
98321
98371
|
this._skyboxMesh = new Mesh(this, {
|
|
98322
98372
|
|
|
98323
98373
|
geometry: new ReadableGeometry(this, { // Box-shaped geometry
|
|
@@ -98348,13 +98398,7 @@ class Skybox extends Component {
|
|
|
98348
98398
|
diffuse: [0, 0, 0],
|
|
98349
98399
|
specular: [0, 0, 0],
|
|
98350
98400
|
emissive: [1, 1, 1],
|
|
98351
|
-
emissiveMap:
|
|
98352
|
-
src: cfg.src,
|
|
98353
|
-
flipY: true,
|
|
98354
|
-
wrapS: "clampToEdge",
|
|
98355
|
-
wrapT: "clampToEdge",
|
|
98356
|
-
encoding: cfg.encoding || "sRGB"
|
|
98357
|
-
}),
|
|
98401
|
+
emissiveMap: texture,
|
|
98358
98402
|
backfaces: true // Show interior faces of our skybox geometry
|
|
98359
98403
|
}),
|
|
98360
98404
|
// stationary: true,
|
|
@@ -98368,6 +98412,86 @@ class Skybox extends Component {
|
|
|
98368
98412
|
this.active = cfg.active;
|
|
98369
98413
|
}
|
|
98370
98414
|
|
|
98415
|
+
/**
|
|
98416
|
+
*
|
|
98417
|
+
* @private
|
|
98418
|
+
* @param {*} cfg
|
|
98419
|
+
* @returns {Texture}
|
|
98420
|
+
*/
|
|
98421
|
+
async _createCombinedTexture(cfg) {
|
|
98422
|
+
const [
|
|
98423
|
+
posX,
|
|
98424
|
+
negX,
|
|
98425
|
+
posY,
|
|
98426
|
+
negY,
|
|
98427
|
+
posZ,
|
|
98428
|
+
negZ
|
|
98429
|
+
] = cfg.src;
|
|
98430
|
+
|
|
98431
|
+
if (!posX || !negX || !posY || !negY || !posZ || !negZ) {
|
|
98432
|
+
throw new Error("All six skybox textures must be provided");
|
|
98433
|
+
}
|
|
98434
|
+
|
|
98435
|
+
const canvas = document.createElement('canvas');
|
|
98436
|
+
const ctx = canvas.getContext('2d');
|
|
98437
|
+
|
|
98438
|
+
const loadImage = src => {
|
|
98439
|
+
return new Promise((resolve, reject) => {
|
|
98440
|
+
const img = new Image();
|
|
98441
|
+
img.crossOrigin = "anonymous";
|
|
98442
|
+
img.onload = () => resolve(img);
|
|
98443
|
+
img.onerror = () => reject(new Error(`Failed to load image: ${src}`));
|
|
98444
|
+
img.src = src;
|
|
98445
|
+
});
|
|
98446
|
+
};
|
|
98447
|
+
|
|
98448
|
+
try {
|
|
98449
|
+
const [imgPosX, imgNegX, imgPosY, imgNegY, imgPosZ, imgNegZ] = await Promise.all([
|
|
98450
|
+
loadImage(posX),
|
|
98451
|
+
loadImage(negX),
|
|
98452
|
+
loadImage(posY),
|
|
98453
|
+
loadImage(negY),
|
|
98454
|
+
loadImage(posZ),
|
|
98455
|
+
loadImage(negZ)
|
|
98456
|
+
]);
|
|
98457
|
+
|
|
98458
|
+
const imageSize = imgPosX.width;
|
|
98459
|
+
if (
|
|
98460
|
+
imgNegX.width !== imageSize || imgPosY.width !== imageSize ||
|
|
98461
|
+
imgNegY.width !== imageSize || imgPosZ.width !== imageSize ||
|
|
98462
|
+
imgNegZ.width !== imageSize
|
|
98463
|
+
) {
|
|
98464
|
+
throw new Error("All skybox textures must have the same dimensions");
|
|
98465
|
+
}
|
|
98466
|
+
|
|
98467
|
+
// Set canvas size for the Christ cross layout (3×4 grid)
|
|
98468
|
+
canvas.width = imageSize * 4;
|
|
98469
|
+
canvas.height = imageSize * 3;
|
|
98470
|
+
|
|
98471
|
+
ctx.fillStyle = 'black';
|
|
98472
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
98473
|
+
|
|
98474
|
+
ctx.drawImage(imgNegX, imageSize * 0, imageSize * 1, imageSize, imageSize); // -X (left)
|
|
98475
|
+
ctx.drawImage(imgPosX, imageSize * 2, imageSize * 1, imageSize, imageSize); // +X (right)
|
|
98476
|
+
ctx.drawImage(imgPosY, imageSize * 1, imageSize * 0, imageSize, imageSize); // +Y (top)
|
|
98477
|
+
ctx.drawImage(imgNegY, imageSize * 1, imageSize * 2, imageSize, imageSize); // -Y (bottom)
|
|
98478
|
+
ctx.drawImage(imgPosZ, imageSize * 1, imageSize * 1, imageSize, imageSize); // +Z (front)
|
|
98479
|
+
ctx.drawImage(imgNegZ, imageSize * 3, imageSize * 1, imageSize, imageSize); // -Z (back)
|
|
98480
|
+
|
|
98481
|
+
const combinedTexture = new Texture(this, {
|
|
98482
|
+
image: canvas,
|
|
98483
|
+
flipY: true,
|
|
98484
|
+
wrapS: ClampToEdgeWrapping,
|
|
98485
|
+
wrapT: ClampToEdgeWrapping,
|
|
98486
|
+
encoding: cfg.encoding || LinearEncoding
|
|
98487
|
+
});
|
|
98488
|
+
|
|
98489
|
+
return combinedTexture;
|
|
98490
|
+
} catch (error) {
|
|
98491
|
+
console.error("Error creating combined skybox texture:", error);
|
|
98492
|
+
throw error;
|
|
98493
|
+
}
|
|
98494
|
+
}
|
|
98371
98495
|
|
|
98372
98496
|
/**
|
|
98373
98497
|
* Sets the size of this Skybox, given as the distance from the center at [0,0,0] to each face.
|
|
@@ -98562,6 +98686,9 @@ const tempVec4a$5 = math.vec4();
|
|
|
98562
98686
|
const tempVec4b$5 = math.vec4();
|
|
98563
98687
|
const tempVec4c = math.vec4();
|
|
98564
98688
|
|
|
98689
|
+
const TOP_LIMIT = 0.001;
|
|
98690
|
+
const BOTTOM_LIMIT = Math.PI - 0.001;
|
|
98691
|
+
|
|
98565
98692
|
|
|
98566
98693
|
/** @private */
|
|
98567
98694
|
class PivotController {
|
|
@@ -98737,14 +98864,9 @@ class PivotController {
|
|
|
98737
98864
|
*/
|
|
98738
98865
|
startPivot() {
|
|
98739
98866
|
|
|
98740
|
-
if (this._cameraLookingDownwards()) {
|
|
98741
|
-
this._pivoting = false;
|
|
98742
|
-
return false;
|
|
98743
|
-
}
|
|
98744
|
-
|
|
98745
98867
|
const camera = this._scene.camera;
|
|
98746
98868
|
|
|
98747
|
-
let lookat = math.lookAtMat4v(camera.eye, camera.look, camera.
|
|
98869
|
+
let lookat = math.lookAtMat4v(camera.eye, camera.look, camera.up);
|
|
98748
98870
|
math.transformPoint3(lookat, this.getPivotPos(), this._cameraOffset);
|
|
98749
98871
|
|
|
98750
98872
|
const pivotPos = this.getPivotPos();
|
|
@@ -98847,8 +98969,31 @@ class PivotController {
|
|
|
98847
98969
|
dx = -dx;
|
|
98848
98970
|
}
|
|
98849
98971
|
this._azimuth += -dx * .01;
|
|
98850
|
-
|
|
98851
|
-
|
|
98972
|
+
|
|
98973
|
+
const isMovingUp = dy < 0;
|
|
98974
|
+
const isMovingDown = dy > 0;
|
|
98975
|
+
|
|
98976
|
+
// Track if we're at limits - only check if we're very close to the limit
|
|
98977
|
+
const atTopLimit = Math.abs(this._polar - TOP_LIMIT) < 0.005;
|
|
98978
|
+
const atBottomLimit = Math.abs(this._polar - BOTTOM_LIMIT) < 0.005;
|
|
98979
|
+
|
|
98980
|
+
let newPolar = this._polar + dy * .01;
|
|
98981
|
+
|
|
98982
|
+
// Case 1: At top limit and trying to go beyond
|
|
98983
|
+
if (atTopLimit && isMovingUp) {
|
|
98984
|
+
newPolar = TOP_LIMIT;
|
|
98985
|
+
}
|
|
98986
|
+
// Case 2: At bottom limit and trying to go beyond
|
|
98987
|
+
else if (atBottomLimit && isMovingDown) {
|
|
98988
|
+
newPolar = BOTTOM_LIMIT;
|
|
98989
|
+
}
|
|
98990
|
+
// Case 3: Normal rotation or moving away from a limit
|
|
98991
|
+
else {
|
|
98992
|
+
newPolar = math.clamp(newPolar, TOP_LIMIT, BOTTOM_LIMIT);
|
|
98993
|
+
}
|
|
98994
|
+
|
|
98995
|
+
this._polar = newPolar;
|
|
98996
|
+
|
|
98852
98997
|
const pos = [
|
|
98853
98998
|
this._radius * Math.sin(this._polar) * Math.sin(this._azimuth),
|
|
98854
98999
|
this._radius * Math.cos(this._polar),
|
|
@@ -112398,22 +112543,6 @@ class Viewer {
|
|
|
112398
112543
|
this.sendToPlugins("snapshotStarting"); // Tells plugins to hide things that shouldn't be in snapshot
|
|
112399
112544
|
}
|
|
112400
112545
|
|
|
112401
|
-
const captured = {};
|
|
112402
|
-
for (let i = 0, len = this._plugins.length; i < len; i++) {
|
|
112403
|
-
const plugin = this._plugins[i];
|
|
112404
|
-
if (plugin.getContainerElement) {
|
|
112405
|
-
const container = plugin.getContainerElement();
|
|
112406
|
-
if (container !== document.body) {
|
|
112407
|
-
if (!captured[container.id]) {
|
|
112408
|
-
captured[container.id] = true;
|
|
112409
|
-
html2canvas(container).then(function (canvas) {
|
|
112410
|
-
document.body.appendChild(canvas);
|
|
112411
|
-
});
|
|
112412
|
-
}
|
|
112413
|
-
}
|
|
112414
|
-
}
|
|
112415
|
-
}
|
|
112416
|
-
|
|
112417
112546
|
// firing "rendering" is necessary to trigger DTX{Lines,Triangles}Layer::_uploadDeferredFlags
|
|
112418
112547
|
this.scene.fire("rendering", { }, true);
|
|
112419
112548
|
|
|
@@ -130064,46 +130193,27 @@ class FaceAlignedSectionPlanesPlugin extends Plugin {
|
|
|
130064
130193
|
* });
|
|
130065
130194
|
*
|
|
130066
130195
|
* // Add a GLTFModelsPlugin
|
|
130067
|
-
* var
|
|
130068
|
-
* id: "GLTFModels" // Default value
|
|
130069
|
-
* });
|
|
130196
|
+
* var xktLoaderPlugin = new XKTLoaderPlugin(viewer);
|
|
130070
130197
|
*
|
|
130071
130198
|
* // Add a SkyboxesPlugin
|
|
130072
|
-
* var skyboxesPlugin = new SkyboxesPlugin(viewer
|
|
130073
|
-
*
|
|
130074
|
-
*
|
|
130199
|
+
* var skyboxesPlugin = new SkyboxesPlugin(viewer);
|
|
130200
|
+
*
|
|
130201
|
+
* // Create a skybox
|
|
130202
|
+
* skyBoxesPlugin.createSkybox({
|
|
130203
|
+
* src: [
|
|
130204
|
+
* "./assets/images/posx.jpg",
|
|
130205
|
+
* "./assets/images/negx.jpg",
|
|
130206
|
+
* "./assets/images/posy.jpg",
|
|
130207
|
+
* "./assets/images/negy.jpg",
|
|
130208
|
+
* "./assets/images/posz.jpg",
|
|
130209
|
+
* "./assets/images/negz.jpg"
|
|
130210
|
+
* ]
|
|
130211
|
+
* })
|
|
130075
130212
|
*
|
|
130076
|
-
* // Load
|
|
130077
|
-
* const model =
|
|
130213
|
+
* // Load an XKT model
|
|
130214
|
+
* const model = xktLoaderPlugin.load({
|
|
130078
130215
|
* id: "myModel",
|
|
130079
|
-
* src: "./models/
|
|
130080
|
-
* });
|
|
130081
|
-
*
|
|
130082
|
-
* // Create three directional World-space lights. "World" means that they will appear as if part
|
|
130083
|
-
* // of the world, instead of "View", where they move with the user's head.
|
|
130084
|
-
*
|
|
130085
|
-
* skyboxesPlugin.createLight({
|
|
130086
|
-
* id: "keyLight",
|
|
130087
|
-
* dir: [0.8, -0.6, -0.8],
|
|
130088
|
-
* color: [1.0, 0.3, 0.3],
|
|
130089
|
-
* intensity: 1.0,
|
|
130090
|
-
* space: "world"
|
|
130091
|
-
* });
|
|
130092
|
-
*
|
|
130093
|
-
* skyboxesPlugin.createLight({
|
|
130094
|
-
* id: "fillLight",
|
|
130095
|
-
* dir: [-0.8, -0.4, -0.4],
|
|
130096
|
-
* color: [0.3, 1.0, 0.3],
|
|
130097
|
-
* intensity: 1.0,
|
|
130098
|
-
* space: "world"
|
|
130099
|
-
* });
|
|
130100
|
-
*
|
|
130101
|
-
* skyboxesPlugin.createDirLight({
|
|
130102
|
-
* id: "rimLight",
|
|
130103
|
-
* dir: [0.2, -0.8, 0.8],
|
|
130104
|
-
* color: [0.6, 0.6, 0.6],
|
|
130105
|
-
* intensity: 1.0,
|
|
130106
|
-
* space: "world"
|
|
130216
|
+
* src: "./models/xkt/myModel.xkt"
|
|
130107
130217
|
* });
|
|
130108
130218
|
*
|
|
130109
130219
|
* @class SkyboxesPlugin
|
|
@@ -130129,23 +130239,17 @@ class SkyboxesPlugin extends Plugin {
|
|
|
130129
130239
|
/**
|
|
130130
130240
|
Creates a skybox.
|
|
130131
130241
|
|
|
130132
|
-
@param {String} id Unique ID to assign to the skybox.
|
|
130133
130242
|
@param {Object} params Skybox configuration.
|
|
130243
|
+
@param {String} [params.id] Optional ID, unique among all components in the parent {Scene}, generated automatically when omitted.
|
|
130244
|
+
@param {String | String[]} [params.src=null] Path to skybox texture
|
|
130245
|
+
@param {Number} [params.encoding=LinearEncoding] Texture encoding format. See the {@link Texture#encoding} property for more info.
|
|
130246
|
+
@param {Number} [params.size=1000] Size of this Skybox, given as the distance from the center at ````[0,0,0]```` to each face.
|
|
130134
130247
|
@param {Boolean} [params.active=true] Whether the skybox plane is initially active. Only skyboxes while this is true.
|
|
130135
130248
|
@returns {Skybox} The new skybox.
|
|
130136
130249
|
*/
|
|
130137
|
-
createSkybox(
|
|
130138
|
-
|
|
130139
|
-
|
|
130140
|
-
return this;
|
|
130141
|
-
}
|
|
130142
|
-
var skybox = new Skybox(this.viewer.scene, {
|
|
130143
|
-
id: id,
|
|
130144
|
-
pos: params.pos,
|
|
130145
|
-
dir: params.dir,
|
|
130146
|
-
active: true
|
|
130147
|
-
});
|
|
130148
|
-
this.skyboxes[id] = skybox;
|
|
130250
|
+
createSkybox(params) {
|
|
130251
|
+
const skybox = new Skybox(this.viewer.scene, params);
|
|
130252
|
+
this.skyboxes[skybox.id] = skybox;
|
|
130149
130253
|
return skybox;
|
|
130150
130254
|
}
|
|
130151
130255
|
|
|
@@ -130808,6 +130912,15 @@ class STLLoaderPlugin extends Plugin {
|
|
|
130808
130912
|
*/
|
|
130809
130913
|
class RenderService {
|
|
130810
130914
|
|
|
130915
|
+
/**
|
|
130916
|
+
* @constructor
|
|
130917
|
+
*
|
|
130918
|
+
* @param {HTMLElement} treeViewContainer Container element for the tree which uses this render service.
|
|
130919
|
+
*/
|
|
130920
|
+
constructor(treeViewContainer) {
|
|
130921
|
+
this._treeViewContainer = treeViewContainer;
|
|
130922
|
+
}
|
|
130923
|
+
|
|
130811
130924
|
/*
|
|
130812
130925
|
* Creates the root node of the tree.
|
|
130813
130926
|
* @return {HTMLElement} The root node of the tree.
|
|
@@ -130932,7 +131045,7 @@ class RenderService {
|
|
|
130932
131045
|
}
|
|
130933
131046
|
|
|
130934
131047
|
getSwitchElement(nodeId) {
|
|
130935
|
-
return
|
|
131048
|
+
return this._treeViewContainer.querySelector(`[id="switch-${nodeId}"]`);
|
|
130936
131049
|
}
|
|
130937
131050
|
|
|
130938
131051
|
isChecked(element) {
|
|
@@ -130940,7 +131053,7 @@ class RenderService {
|
|
|
130940
131053
|
}
|
|
130941
131054
|
|
|
130942
131055
|
setCheckbox(nodeId, checked, indeterminate = false) {
|
|
130943
|
-
const checkbox =
|
|
131056
|
+
const checkbox = this._treeViewContainer.querySelector(`[id="checkbox-${nodeId}"]`);
|
|
130944
131057
|
if (checkbox) {
|
|
130945
131058
|
if (checked !== checkbox.checked) {
|
|
130946
131059
|
checkbox.checked = checked;
|
|
@@ -130955,7 +131068,7 @@ class RenderService {
|
|
|
130955
131068
|
}
|
|
130956
131069
|
|
|
130957
131070
|
setXRayed(nodeId, xrayed) {
|
|
130958
|
-
const treeNode =
|
|
131071
|
+
const treeNode = this._treeViewContainer.querySelector(`[id="${nodeId}"]`);
|
|
130959
131072
|
if (treeNode) {
|
|
130960
131073
|
if (xrayed) {
|
|
130961
131074
|
treeNode.classList.add('xrayed-node');
|
|
@@ -130966,7 +131079,7 @@ class RenderService {
|
|
|
130966
131079
|
}
|
|
130967
131080
|
|
|
130968
131081
|
setHighlighted(nodeId, highlighted) {
|
|
130969
|
-
const treeNode =
|
|
131082
|
+
const treeNode = this._treeViewContainer.querySelector(`[id="${nodeId}"]`);
|
|
130970
131083
|
if (treeNode) {
|
|
130971
131084
|
if (highlighted) {
|
|
130972
131085
|
treeNode.scrollIntoView({block: "center"});
|
|
@@ -131392,7 +131505,7 @@ class TreeViewPlugin extends Plugin {
|
|
|
131392
131505
|
this._sortNodes = cfg.sortNodes;
|
|
131393
131506
|
this._pruneEmptyNodes = cfg.pruneEmptyNodes;
|
|
131394
131507
|
this._showListItemElementId = null;
|
|
131395
|
-
this._renderService = cfg.renderService || new RenderService();
|
|
131508
|
+
this._renderService = cfg.renderService || new RenderService(this._containerElement);
|
|
131396
131509
|
this._showIndeterminate = cfg.showIndeterminate ?? false;
|
|
131397
131510
|
this._showProjectNode = cfg.showProjectNode ?? false;
|
|
131398
131511
|
this._elevationSortFunction = cfg.elevationSortFunction ?? undefined;
|