@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.es.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
|
/** @private */
|
|
@@ -346,7 +346,8 @@ class ContextMenu {
|
|
|
346
346
|
this._shown = false; // True when the ContextMenu is visible
|
|
347
347
|
this._nextId = 0;
|
|
348
348
|
this._parentNode = cfg.parentNode || document.body;
|
|
349
|
-
|
|
349
|
+
this._offsetParent = (this._parentNode instanceof ShadowRoot) ? this._parentNode.host : this._parentNode;
|
|
350
|
+
|
|
350
351
|
/**
|
|
351
352
|
* Subscriptions to events fired at this ContextMenu.
|
|
352
353
|
* @private
|
|
@@ -558,7 +559,7 @@ class ContextMenu {
|
|
|
558
559
|
for (let i = 0, len = this._menuList.length; i < len; i++) {
|
|
559
560
|
const menu = this._menuList[i];
|
|
560
561
|
const menuElement = menu.menuElement;
|
|
561
|
-
menuElement.
|
|
562
|
+
menuElement.remove();
|
|
562
563
|
}
|
|
563
564
|
this._itemsCfg = [];
|
|
564
565
|
this._rootMenu = null;
|
|
@@ -786,21 +787,22 @@ class ContextMenu {
|
|
|
786
787
|
|
|
787
788
|
const itemRect = itemElement.getBoundingClientRect();
|
|
788
789
|
subMenuElement.getBoundingClientRect();
|
|
790
|
+
const offsetRect = self._offsetParent.getBoundingClientRect();
|
|
789
791
|
|
|
790
792
|
const subMenuWidth = 200; // TODO
|
|
791
|
-
const showOnRight = (itemRect.right + subMenuWidth) <
|
|
792
|
-
const showOnLeft = (itemRect.left - subMenuWidth) >
|
|
793
|
-
|
|
793
|
+
const showOnRight = (itemRect.right + subMenuWidth) < offsetRect.right;
|
|
794
|
+
const showOnLeft = (itemRect.left - subMenuWidth) > offsetRect.left;
|
|
795
|
+
|
|
794
796
|
if(showOnRight)
|
|
795
|
-
self._showMenu(subMenu.id, itemRect.right - 5, itemRect.top - 1);
|
|
797
|
+
self._showMenu(subMenu.id, itemRect.right + window.scrollX - 5, itemRect.top + window.scrollY - 1);
|
|
796
798
|
else if (showOnLeft)
|
|
797
|
-
self._showMenu(subMenu.id, itemRect.left - subMenuWidth, itemRect.top - 1);
|
|
799
|
+
self._showMenu(subMenu.id, itemRect.left - subMenuWidth + window.scrollX, itemRect.top + window.scrollY - 1);
|
|
798
800
|
else {
|
|
799
|
-
const spaceOnLeft = itemRect.left, spaceOnRight =
|
|
801
|
+
const spaceOnLeft = itemRect.left - offsetRect.left, spaceOnRight = offsetRect.right - itemRect.right;
|
|
800
802
|
if(spaceOnRight > spaceOnLeft)
|
|
801
|
-
self._showMenu(subMenu.id, itemRect.right - 5 - (subMenuWidth - spaceOnRight), itemRect.top - 1);
|
|
803
|
+
self._showMenu(subMenu.id, itemRect.right - 5 - (subMenuWidth - spaceOnRight), itemRect.top + window.scrollY - 1);
|
|
802
804
|
else
|
|
803
|
-
self._showMenu(subMenu.id, itemRect.left - spaceOnLeft, itemRect.top - 1);
|
|
805
|
+
self._showMenu(subMenu.id, itemRect.left - spaceOnLeft, itemRect.top + window.scrollY - 1);
|
|
804
806
|
}
|
|
805
807
|
|
|
806
808
|
lastSubMenu = subMenu;
|
|
@@ -993,14 +995,21 @@ class ContextMenu {
|
|
|
993
995
|
menuElement.style.display = 'block';
|
|
994
996
|
const menuHeight = menuElement.offsetHeight;
|
|
995
997
|
const menuWidth = menuElement.offsetWidth;
|
|
996
|
-
|
|
997
|
-
|
|
998
|
+
|
|
999
|
+
const offsetRect = this._offsetParent.getBoundingClientRect();
|
|
1000
|
+
|
|
1001
|
+
const bottomContainerBorder = offsetRect.bottom + window.scrollY;
|
|
1002
|
+
const rightContainerBorder = offsetRect.right + window.scrollX;
|
|
1003
|
+
if ((pageY + menuHeight) > bottomContainerBorder) {
|
|
1004
|
+
pageY = bottomContainerBorder- menuHeight;
|
|
998
1005
|
}
|
|
999
|
-
if ((pageX + menuWidth) >
|
|
1000
|
-
pageX =
|
|
1006
|
+
if ((pageX + menuWidth) > rightContainerBorder) {
|
|
1007
|
+
pageX = rightContainerBorder - menuWidth;
|
|
1001
1008
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
menuElement.style.left = pageX - offsetRect.left - window.scrollX + 'px';
|
|
1012
|
+
menuElement.style.top = pageY - offsetRect.top - window.scrollY + 'px';
|
|
1004
1013
|
}
|
|
1005
1014
|
|
|
1006
1015
|
_hideMenuElement(menuElement) {
|
|
@@ -89179,7 +89188,7 @@ class LineSet extends Component {
|
|
|
89179
89188
|
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
|
89180
89189
|
* @param {Number[]} cfg.positions World-space 3D vertex positions.
|
|
89181
89190
|
* @param {Number[]} [cfg.indices] Indices to connect ````positions```` into line segments. Note that these are separate line segments, not a polyline.
|
|
89182
|
-
* @param {Number[]} [cfg.color=[
|
|
89191
|
+
* @param {Number[]} [cfg.color=[1,1,1]] The color of this ````LineSet````. This is both emissive and diffuse.
|
|
89183
89192
|
* @param {Boolean} [cfg.visible=true] Indicates whether or not this ````LineSet```` is visible.
|
|
89184
89193
|
* @param {Number} [cfg.opacity=1.0] ````LineSet````'s initial opacity factor.
|
|
89185
89194
|
*/
|
|
@@ -89199,6 +89208,9 @@ class LineSet extends Component {
|
|
|
89199
89208
|
}
|
|
89200
89209
|
}
|
|
89201
89210
|
|
|
89211
|
+
this._color = cfg.color || [1, 1, 1];
|
|
89212
|
+
this._opacity = cfg.opacity || 1.0;
|
|
89213
|
+
|
|
89202
89214
|
this._sceneModel = new SceneModel(this, {
|
|
89203
89215
|
isModel: false // Don't register in Scene.models
|
|
89204
89216
|
});
|
|
@@ -89207,7 +89219,9 @@ class LineSet extends Component {
|
|
|
89207
89219
|
id: "linesMesh",
|
|
89208
89220
|
primitive: "lines",
|
|
89209
89221
|
positions: this._positions,
|
|
89210
|
-
indices: this._indices
|
|
89222
|
+
indices: this._indices,
|
|
89223
|
+
color: this._color,
|
|
89224
|
+
opacity: this._opacity,
|
|
89211
89225
|
});
|
|
89212
89226
|
|
|
89213
89227
|
this._sceneModel.createEntity({
|
|
@@ -92935,6 +92949,7 @@ class FastNavPlugin extends Plugin {
|
|
|
92935
92949
|
* @param {Number} [cfg.scaleCanvasResolutionFactor=0.6] The factor by which we downscale the canvas resolution whenever we interact with the Viewer.
|
|
92936
92950
|
* @param {Boolean} [cfg.delayBeforeRestore=true] Whether to temporarily have a delay before restoring normal rendering after we stop interacting with the Viewer.
|
|
92937
92951
|
* @param {Number} [cfg.delayBeforeRestoreSeconds=0.5] Delay in seconds before restoring normal rendering after we stop interacting with the Viewer.
|
|
92952
|
+
* @param {Function} [cfg.onMoved] Optional callback function fired during moving mode, should return the callback function that will be fired when the interaction stops.
|
|
92938
92953
|
*/
|
|
92939
92954
|
constructor(viewer, cfg = {}) {
|
|
92940
92955
|
|
|
@@ -92950,6 +92965,8 @@ class FastNavPlugin extends Plugin {
|
|
|
92950
92965
|
this._scaleCanvasResolutionFactor = cfg.scaleCanvasResolutionFactor || 0.6;
|
|
92951
92966
|
this._delayBeforeRestore = (cfg.delayBeforeRestore !== false);
|
|
92952
92967
|
this._delayBeforeRestoreSeconds = cfg.delayBeforeRestoreSeconds || 0.5;
|
|
92968
|
+
this._onMoved = cfg.onMoved;
|
|
92969
|
+
this._onStopped = null;
|
|
92953
92970
|
|
|
92954
92971
|
let timer = this._delayBeforeRestoreSeconds * 1000;
|
|
92955
92972
|
let fastMode = false;
|
|
@@ -92968,6 +92985,10 @@ class FastNavPlugin extends Plugin {
|
|
|
92968
92985
|
} else {
|
|
92969
92986
|
viewer.scene.canvas.resolutionScale = this._defaultScaleCanvasResolutionFactor;
|
|
92970
92987
|
}
|
|
92988
|
+
if (this._onMoved) {
|
|
92989
|
+
this._onStopped = this._onMoved();
|
|
92990
|
+
}
|
|
92991
|
+
|
|
92971
92992
|
fastMode = true;
|
|
92972
92993
|
}
|
|
92973
92994
|
};
|
|
@@ -92979,6 +93000,9 @@ class FastNavPlugin extends Plugin {
|
|
|
92979
93000
|
viewer.scene._renderer.setPBREnabled(true);
|
|
92980
93001
|
viewer.scene._renderer.setSAOEnabled(true);
|
|
92981
93002
|
viewer.scene._renderer.setTransparentEnabled(true);
|
|
93003
|
+
if (this._onStopped) {
|
|
93004
|
+
this._onStopped();
|
|
93005
|
+
}
|
|
92982
93006
|
fastMode = false;
|
|
92983
93007
|
};
|
|
92984
93008
|
|
|
@@ -98305,8 +98329,8 @@ class Skybox extends Component {
|
|
|
98305
98329
|
* @param {Component} owner Owner component. When destroyed, the owner will destroy this PointLight as well.
|
|
98306
98330
|
* @param {*} [cfg] Skybox configuration
|
|
98307
98331
|
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {Scene}, generated automatically when omitted.
|
|
98308
|
-
* @param {String} [cfg.src=null] Path to skybox texture
|
|
98309
|
-
* @param {
|
|
98332
|
+
* @param {String | String[]} [cfg.src=null] Path to skybox texture
|
|
98333
|
+
* @param {Number} [cfg.encoding=LinearEncoding] Texture encoding format. See the {@link Texture#encoding} property for more info.
|
|
98310
98334
|
* @param {Number} [cfg.size=1000] Size of this Skybox, given as the distance from the center at ````[0,0,0]```` to each face.
|
|
98311
98335
|
* @param {Boolean} [cfg.active=true] True when this Skybox is visible.
|
|
98312
98336
|
*/
|
|
@@ -98314,6 +98338,32 @@ class Skybox extends Component {
|
|
|
98314
98338
|
|
|
98315
98339
|
super(owner, cfg);
|
|
98316
98340
|
|
|
98341
|
+
const useMultipleTexture = typeof cfg.src === "object" && cfg.src !== null;
|
|
98342
|
+
|
|
98343
|
+
if (useMultipleTexture) {
|
|
98344
|
+
this._createCombinedTexture(cfg).then(combinedTexture => {
|
|
98345
|
+
this._createSkyboxMesh(cfg, combinedTexture);
|
|
98346
|
+
}).catch(e => this.error(e));
|
|
98347
|
+
} else {
|
|
98348
|
+
this._createSkyboxMesh(cfg);
|
|
98349
|
+
}
|
|
98350
|
+
}
|
|
98351
|
+
|
|
98352
|
+
/**
|
|
98353
|
+
*
|
|
98354
|
+
* @private
|
|
98355
|
+
* @param {*} cfg
|
|
98356
|
+
* @param {Texture} combinedTexture
|
|
98357
|
+
*/
|
|
98358
|
+
_createSkyboxMesh(cfg, combinedTexture = null) {
|
|
98359
|
+
const texture = combinedTexture || new Texture(this, {
|
|
98360
|
+
src: cfg.src,
|
|
98361
|
+
flipY: true,
|
|
98362
|
+
wrapS: ClampToEdgeWrapping,
|
|
98363
|
+
wrapT: ClampToEdgeWrapping,
|
|
98364
|
+
encoding: cfg.encoding || LinearEncoding
|
|
98365
|
+
});
|
|
98366
|
+
|
|
98317
98367
|
this._skyboxMesh = new Mesh(this, {
|
|
98318
98368
|
|
|
98319
98369
|
geometry: new ReadableGeometry(this, { // Box-shaped geometry
|
|
@@ -98344,13 +98394,7 @@ class Skybox extends Component {
|
|
|
98344
98394
|
diffuse: [0, 0, 0],
|
|
98345
98395
|
specular: [0, 0, 0],
|
|
98346
98396
|
emissive: [1, 1, 1],
|
|
98347
|
-
emissiveMap:
|
|
98348
|
-
src: cfg.src,
|
|
98349
|
-
flipY: true,
|
|
98350
|
-
wrapS: "clampToEdge",
|
|
98351
|
-
wrapT: "clampToEdge",
|
|
98352
|
-
encoding: cfg.encoding || "sRGB"
|
|
98353
|
-
}),
|
|
98397
|
+
emissiveMap: texture,
|
|
98354
98398
|
backfaces: true // Show interior faces of our skybox geometry
|
|
98355
98399
|
}),
|
|
98356
98400
|
// stationary: true,
|
|
@@ -98364,6 +98408,86 @@ class Skybox extends Component {
|
|
|
98364
98408
|
this.active = cfg.active;
|
|
98365
98409
|
}
|
|
98366
98410
|
|
|
98411
|
+
/**
|
|
98412
|
+
*
|
|
98413
|
+
* @private
|
|
98414
|
+
* @param {*} cfg
|
|
98415
|
+
* @returns {Texture}
|
|
98416
|
+
*/
|
|
98417
|
+
async _createCombinedTexture(cfg) {
|
|
98418
|
+
const [
|
|
98419
|
+
posX,
|
|
98420
|
+
negX,
|
|
98421
|
+
posY,
|
|
98422
|
+
negY,
|
|
98423
|
+
posZ,
|
|
98424
|
+
negZ
|
|
98425
|
+
] = cfg.src;
|
|
98426
|
+
|
|
98427
|
+
if (!posX || !negX || !posY || !negY || !posZ || !negZ) {
|
|
98428
|
+
throw new Error("All six skybox textures must be provided");
|
|
98429
|
+
}
|
|
98430
|
+
|
|
98431
|
+
const canvas = document.createElement('canvas');
|
|
98432
|
+
const ctx = canvas.getContext('2d');
|
|
98433
|
+
|
|
98434
|
+
const loadImage = src => {
|
|
98435
|
+
return new Promise((resolve, reject) => {
|
|
98436
|
+
const img = new Image();
|
|
98437
|
+
img.crossOrigin = "anonymous";
|
|
98438
|
+
img.onload = () => resolve(img);
|
|
98439
|
+
img.onerror = () => reject(new Error(`Failed to load image: ${src}`));
|
|
98440
|
+
img.src = src;
|
|
98441
|
+
});
|
|
98442
|
+
};
|
|
98443
|
+
|
|
98444
|
+
try {
|
|
98445
|
+
const [imgPosX, imgNegX, imgPosY, imgNegY, imgPosZ, imgNegZ] = await Promise.all([
|
|
98446
|
+
loadImage(posX),
|
|
98447
|
+
loadImage(negX),
|
|
98448
|
+
loadImage(posY),
|
|
98449
|
+
loadImage(negY),
|
|
98450
|
+
loadImage(posZ),
|
|
98451
|
+
loadImage(negZ)
|
|
98452
|
+
]);
|
|
98453
|
+
|
|
98454
|
+
const imageSize = imgPosX.width;
|
|
98455
|
+
if (
|
|
98456
|
+
imgNegX.width !== imageSize || imgPosY.width !== imageSize ||
|
|
98457
|
+
imgNegY.width !== imageSize || imgPosZ.width !== imageSize ||
|
|
98458
|
+
imgNegZ.width !== imageSize
|
|
98459
|
+
) {
|
|
98460
|
+
throw new Error("All skybox textures must have the same dimensions");
|
|
98461
|
+
}
|
|
98462
|
+
|
|
98463
|
+
// Set canvas size for the Christ cross layout (3×4 grid)
|
|
98464
|
+
canvas.width = imageSize * 4;
|
|
98465
|
+
canvas.height = imageSize * 3;
|
|
98466
|
+
|
|
98467
|
+
ctx.fillStyle = 'black';
|
|
98468
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
98469
|
+
|
|
98470
|
+
ctx.drawImage(imgNegX, imageSize * 0, imageSize * 1, imageSize, imageSize); // -X (left)
|
|
98471
|
+
ctx.drawImage(imgPosX, imageSize * 2, imageSize * 1, imageSize, imageSize); // +X (right)
|
|
98472
|
+
ctx.drawImage(imgPosY, imageSize * 1, imageSize * 0, imageSize, imageSize); // +Y (top)
|
|
98473
|
+
ctx.drawImage(imgNegY, imageSize * 1, imageSize * 2, imageSize, imageSize); // -Y (bottom)
|
|
98474
|
+
ctx.drawImage(imgPosZ, imageSize * 1, imageSize * 1, imageSize, imageSize); // +Z (front)
|
|
98475
|
+
ctx.drawImage(imgNegZ, imageSize * 3, imageSize * 1, imageSize, imageSize); // -Z (back)
|
|
98476
|
+
|
|
98477
|
+
const combinedTexture = new Texture(this, {
|
|
98478
|
+
image: canvas,
|
|
98479
|
+
flipY: true,
|
|
98480
|
+
wrapS: ClampToEdgeWrapping,
|
|
98481
|
+
wrapT: ClampToEdgeWrapping,
|
|
98482
|
+
encoding: cfg.encoding || LinearEncoding
|
|
98483
|
+
});
|
|
98484
|
+
|
|
98485
|
+
return combinedTexture;
|
|
98486
|
+
} catch (error) {
|
|
98487
|
+
console.error("Error creating combined skybox texture:", error);
|
|
98488
|
+
throw error;
|
|
98489
|
+
}
|
|
98490
|
+
}
|
|
98367
98491
|
|
|
98368
98492
|
/**
|
|
98369
98493
|
* Sets the size of this Skybox, given as the distance from the center at [0,0,0] to each face.
|
|
@@ -98558,6 +98682,9 @@ const tempVec4a$5 = math.vec4();
|
|
|
98558
98682
|
const tempVec4b$5 = math.vec4();
|
|
98559
98683
|
const tempVec4c = math.vec4();
|
|
98560
98684
|
|
|
98685
|
+
const TOP_LIMIT = 0.001;
|
|
98686
|
+
const BOTTOM_LIMIT = Math.PI - 0.001;
|
|
98687
|
+
|
|
98561
98688
|
|
|
98562
98689
|
/** @private */
|
|
98563
98690
|
class PivotController {
|
|
@@ -98733,14 +98860,9 @@ class PivotController {
|
|
|
98733
98860
|
*/
|
|
98734
98861
|
startPivot() {
|
|
98735
98862
|
|
|
98736
|
-
if (this._cameraLookingDownwards()) {
|
|
98737
|
-
this._pivoting = false;
|
|
98738
|
-
return false;
|
|
98739
|
-
}
|
|
98740
|
-
|
|
98741
98863
|
const camera = this._scene.camera;
|
|
98742
98864
|
|
|
98743
|
-
let lookat = math.lookAtMat4v(camera.eye, camera.look, camera.
|
|
98865
|
+
let lookat = math.lookAtMat4v(camera.eye, camera.look, camera.up);
|
|
98744
98866
|
math.transformPoint3(lookat, this.getPivotPos(), this._cameraOffset);
|
|
98745
98867
|
|
|
98746
98868
|
const pivotPos = this.getPivotPos();
|
|
@@ -98843,8 +98965,31 @@ class PivotController {
|
|
|
98843
98965
|
dx = -dx;
|
|
98844
98966
|
}
|
|
98845
98967
|
this._azimuth += -dx * .01;
|
|
98846
|
-
|
|
98847
|
-
|
|
98968
|
+
|
|
98969
|
+
const isMovingUp = dy < 0;
|
|
98970
|
+
const isMovingDown = dy > 0;
|
|
98971
|
+
|
|
98972
|
+
// Track if we're at limits - only check if we're very close to the limit
|
|
98973
|
+
const atTopLimit = Math.abs(this._polar - TOP_LIMIT) < 0.005;
|
|
98974
|
+
const atBottomLimit = Math.abs(this._polar - BOTTOM_LIMIT) < 0.005;
|
|
98975
|
+
|
|
98976
|
+
let newPolar = this._polar + dy * .01;
|
|
98977
|
+
|
|
98978
|
+
// Case 1: At top limit and trying to go beyond
|
|
98979
|
+
if (atTopLimit && isMovingUp) {
|
|
98980
|
+
newPolar = TOP_LIMIT;
|
|
98981
|
+
}
|
|
98982
|
+
// Case 2: At bottom limit and trying to go beyond
|
|
98983
|
+
else if (atBottomLimit && isMovingDown) {
|
|
98984
|
+
newPolar = BOTTOM_LIMIT;
|
|
98985
|
+
}
|
|
98986
|
+
// Case 3: Normal rotation or moving away from a limit
|
|
98987
|
+
else {
|
|
98988
|
+
newPolar = math.clamp(newPolar, TOP_LIMIT, BOTTOM_LIMIT);
|
|
98989
|
+
}
|
|
98990
|
+
|
|
98991
|
+
this._polar = newPolar;
|
|
98992
|
+
|
|
98848
98993
|
const pos = [
|
|
98849
98994
|
this._radius * Math.sin(this._polar) * Math.sin(this._azimuth),
|
|
98850
98995
|
this._radius * Math.cos(this._polar),
|
|
@@ -112394,22 +112539,6 @@ class Viewer {
|
|
|
112394
112539
|
this.sendToPlugins("snapshotStarting"); // Tells plugins to hide things that shouldn't be in snapshot
|
|
112395
112540
|
}
|
|
112396
112541
|
|
|
112397
|
-
const captured = {};
|
|
112398
|
-
for (let i = 0, len = this._plugins.length; i < len; i++) {
|
|
112399
|
-
const plugin = this._plugins[i];
|
|
112400
|
-
if (plugin.getContainerElement) {
|
|
112401
|
-
const container = plugin.getContainerElement();
|
|
112402
|
-
if (container !== document.body) {
|
|
112403
|
-
if (!captured[container.id]) {
|
|
112404
|
-
captured[container.id] = true;
|
|
112405
|
-
html2canvas(container).then(function (canvas) {
|
|
112406
|
-
document.body.appendChild(canvas);
|
|
112407
|
-
});
|
|
112408
|
-
}
|
|
112409
|
-
}
|
|
112410
|
-
}
|
|
112411
|
-
}
|
|
112412
|
-
|
|
112413
112542
|
// firing "rendering" is necessary to trigger DTX{Lines,Triangles}Layer::_uploadDeferredFlags
|
|
112414
112543
|
this.scene.fire("rendering", { }, true);
|
|
112415
112544
|
|
|
@@ -130060,46 +130189,27 @@ class FaceAlignedSectionPlanesPlugin extends Plugin {
|
|
|
130060
130189
|
* });
|
|
130061
130190
|
*
|
|
130062
130191
|
* // Add a GLTFModelsPlugin
|
|
130063
|
-
* var
|
|
130064
|
-
* id: "GLTFModels" // Default value
|
|
130065
|
-
* });
|
|
130192
|
+
* var xktLoaderPlugin = new XKTLoaderPlugin(viewer);
|
|
130066
130193
|
*
|
|
130067
130194
|
* // Add a SkyboxesPlugin
|
|
130068
|
-
* var skyboxesPlugin = new SkyboxesPlugin(viewer
|
|
130069
|
-
*
|
|
130070
|
-
*
|
|
130195
|
+
* var skyboxesPlugin = new SkyboxesPlugin(viewer);
|
|
130196
|
+
*
|
|
130197
|
+
* // Create a skybox
|
|
130198
|
+
* skyBoxesPlugin.createSkybox({
|
|
130199
|
+
* src: [
|
|
130200
|
+
* "./assets/images/posx.jpg",
|
|
130201
|
+
* "./assets/images/negx.jpg",
|
|
130202
|
+
* "./assets/images/posy.jpg",
|
|
130203
|
+
* "./assets/images/negy.jpg",
|
|
130204
|
+
* "./assets/images/posz.jpg",
|
|
130205
|
+
* "./assets/images/negz.jpg"
|
|
130206
|
+
* ]
|
|
130207
|
+
* })
|
|
130071
130208
|
*
|
|
130072
|
-
* // Load
|
|
130073
|
-
* const model =
|
|
130209
|
+
* // Load an XKT model
|
|
130210
|
+
* const model = xktLoaderPlugin.load({
|
|
130074
130211
|
* id: "myModel",
|
|
130075
|
-
* src: "./models/
|
|
130076
|
-
* });
|
|
130077
|
-
*
|
|
130078
|
-
* // Create three directional World-space lights. "World" means that they will appear as if part
|
|
130079
|
-
* // of the world, instead of "View", where they move with the user's head.
|
|
130080
|
-
*
|
|
130081
|
-
* skyboxesPlugin.createLight({
|
|
130082
|
-
* id: "keyLight",
|
|
130083
|
-
* dir: [0.8, -0.6, -0.8],
|
|
130084
|
-
* color: [1.0, 0.3, 0.3],
|
|
130085
|
-
* intensity: 1.0,
|
|
130086
|
-
* space: "world"
|
|
130087
|
-
* });
|
|
130088
|
-
*
|
|
130089
|
-
* skyboxesPlugin.createLight({
|
|
130090
|
-
* id: "fillLight",
|
|
130091
|
-
* dir: [-0.8, -0.4, -0.4],
|
|
130092
|
-
* color: [0.3, 1.0, 0.3],
|
|
130093
|
-
* intensity: 1.0,
|
|
130094
|
-
* space: "world"
|
|
130095
|
-
* });
|
|
130096
|
-
*
|
|
130097
|
-
* skyboxesPlugin.createDirLight({
|
|
130098
|
-
* id: "rimLight",
|
|
130099
|
-
* dir: [0.2, -0.8, 0.8],
|
|
130100
|
-
* color: [0.6, 0.6, 0.6],
|
|
130101
|
-
* intensity: 1.0,
|
|
130102
|
-
* space: "world"
|
|
130212
|
+
* src: "./models/xkt/myModel.xkt"
|
|
130103
130213
|
* });
|
|
130104
130214
|
*
|
|
130105
130215
|
* @class SkyboxesPlugin
|
|
@@ -130125,23 +130235,17 @@ class SkyboxesPlugin extends Plugin {
|
|
|
130125
130235
|
/**
|
|
130126
130236
|
Creates a skybox.
|
|
130127
130237
|
|
|
130128
|
-
@param {String} id Unique ID to assign to the skybox.
|
|
130129
130238
|
@param {Object} params Skybox configuration.
|
|
130239
|
+
@param {String} [params.id] Optional ID, unique among all components in the parent {Scene}, generated automatically when omitted.
|
|
130240
|
+
@param {String | String[]} [params.src=null] Path to skybox texture
|
|
130241
|
+
@param {Number} [params.encoding=LinearEncoding] Texture encoding format. See the {@link Texture#encoding} property for more info.
|
|
130242
|
+
@param {Number} [params.size=1000] Size of this Skybox, given as the distance from the center at ````[0,0,0]```` to each face.
|
|
130130
130243
|
@param {Boolean} [params.active=true] Whether the skybox plane is initially active. Only skyboxes while this is true.
|
|
130131
130244
|
@returns {Skybox} The new skybox.
|
|
130132
130245
|
*/
|
|
130133
|
-
createSkybox(
|
|
130134
|
-
|
|
130135
|
-
|
|
130136
|
-
return this;
|
|
130137
|
-
}
|
|
130138
|
-
var skybox = new Skybox(this.viewer.scene, {
|
|
130139
|
-
id: id,
|
|
130140
|
-
pos: params.pos,
|
|
130141
|
-
dir: params.dir,
|
|
130142
|
-
active: true
|
|
130143
|
-
});
|
|
130144
|
-
this.skyboxes[id] = skybox;
|
|
130246
|
+
createSkybox(params) {
|
|
130247
|
+
const skybox = new Skybox(this.viewer.scene, params);
|
|
130248
|
+
this.skyboxes[skybox.id] = skybox;
|
|
130145
130249
|
return skybox;
|
|
130146
130250
|
}
|
|
130147
130251
|
|
|
@@ -130804,6 +130908,15 @@ class STLLoaderPlugin extends Plugin {
|
|
|
130804
130908
|
*/
|
|
130805
130909
|
class RenderService {
|
|
130806
130910
|
|
|
130911
|
+
/**
|
|
130912
|
+
* @constructor
|
|
130913
|
+
*
|
|
130914
|
+
* @param {HTMLElement} treeViewContainer Container element for the tree which uses this render service.
|
|
130915
|
+
*/
|
|
130916
|
+
constructor(treeViewContainer) {
|
|
130917
|
+
this._treeViewContainer = treeViewContainer;
|
|
130918
|
+
}
|
|
130919
|
+
|
|
130807
130920
|
/*
|
|
130808
130921
|
* Creates the root node of the tree.
|
|
130809
130922
|
* @return {HTMLElement} The root node of the tree.
|
|
@@ -130928,7 +131041,7 @@ class RenderService {
|
|
|
130928
131041
|
}
|
|
130929
131042
|
|
|
130930
131043
|
getSwitchElement(nodeId) {
|
|
130931
|
-
return
|
|
131044
|
+
return this._treeViewContainer.querySelector(`[id="switch-${nodeId}"]`);
|
|
130932
131045
|
}
|
|
130933
131046
|
|
|
130934
131047
|
isChecked(element) {
|
|
@@ -130936,7 +131049,7 @@ class RenderService {
|
|
|
130936
131049
|
}
|
|
130937
131050
|
|
|
130938
131051
|
setCheckbox(nodeId, checked, indeterminate = false) {
|
|
130939
|
-
const checkbox =
|
|
131052
|
+
const checkbox = this._treeViewContainer.querySelector(`[id="checkbox-${nodeId}"]`);
|
|
130940
131053
|
if (checkbox) {
|
|
130941
131054
|
if (checked !== checkbox.checked) {
|
|
130942
131055
|
checkbox.checked = checked;
|
|
@@ -130951,7 +131064,7 @@ class RenderService {
|
|
|
130951
131064
|
}
|
|
130952
131065
|
|
|
130953
131066
|
setXRayed(nodeId, xrayed) {
|
|
130954
|
-
const treeNode =
|
|
131067
|
+
const treeNode = this._treeViewContainer.querySelector(`[id="${nodeId}"]`);
|
|
130955
131068
|
if (treeNode) {
|
|
130956
131069
|
if (xrayed) {
|
|
130957
131070
|
treeNode.classList.add('xrayed-node');
|
|
@@ -130962,7 +131075,7 @@ class RenderService {
|
|
|
130962
131075
|
}
|
|
130963
131076
|
|
|
130964
131077
|
setHighlighted(nodeId, highlighted) {
|
|
130965
|
-
const treeNode =
|
|
131078
|
+
const treeNode = this._treeViewContainer.querySelector(`[id="${nodeId}"]`);
|
|
130966
131079
|
if (treeNode) {
|
|
130967
131080
|
if (highlighted) {
|
|
130968
131081
|
treeNode.scrollIntoView({block: "center"});
|
|
@@ -131388,7 +131501,7 @@ class TreeViewPlugin extends Plugin {
|
|
|
131388
131501
|
this._sortNodes = cfg.sortNodes;
|
|
131389
131502
|
this._pruneEmptyNodes = cfg.pruneEmptyNodes;
|
|
131390
131503
|
this._showListItemElementId = null;
|
|
131391
|
-
this._renderService = cfg.renderService || new RenderService();
|
|
131504
|
+
this._renderService = cfg.renderService || new RenderService(this._containerElement);
|
|
131392
131505
|
this._showIndeterminate = cfg.showIndeterminate ?? false;
|
|
131393
131506
|
this._showProjectNode = cfg.showProjectNode ?? false;
|
|
131394
131507
|
this._elevationSortFunction = cfg.elevationSortFunction ?? undefined;
|