@splnlss/3d-story-viewer 0.5.3 → 0.5.5
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/README.md +3 -3
- package/build/types/src/viewer/GlobeManager.d.ts +1 -1
- package/build/viewer.cjs +1 -1
- package/build/viewer.js +25 -12
- package/package.json +1 -1
package/build/viewer.js
CHANGED
|
@@ -25659,9 +25659,12 @@ class GlobeManager extends EventDispatcher {
|
|
|
25659
25659
|
this.camera = camera;
|
|
25660
25660
|
this.renderer = renderer;
|
|
25661
25661
|
this.tiles = null;
|
|
25662
|
+
this.dracoLoader = null;
|
|
25662
25663
|
this.apiToken = options.apiToken;
|
|
25663
25664
|
this.googleMapsToken = options.googleMapsToken;
|
|
25664
|
-
this.
|
|
25665
|
+
if (this.googleMapsToken) {
|
|
25666
|
+
this.initTiles();
|
|
25667
|
+
}
|
|
25665
25668
|
}
|
|
25666
25669
|
initTiles() {
|
|
25667
25670
|
if (this.tiles) {
|
|
@@ -26493,7 +26496,7 @@ TWEEN.update.bind(TWEEN);
|
|
|
26493
26496
|
var exports = {
|
|
26494
26497
|
Easing
|
|
26495
26498
|
};
|
|
26496
|
-
const Tokens
|
|
26499
|
+
const Tokens = {
|
|
26497
26500
|
CESIUM: void 0,
|
|
26498
26501
|
GOOGLEMAPS: void 0
|
|
26499
26502
|
};
|
|
@@ -27399,12 +27402,13 @@ class Viewer extends EventDispatcher {
|
|
|
27399
27402
|
this.type = "viewer";
|
|
27400
27403
|
this.disposed = false;
|
|
27401
27404
|
this.sparkRenderer = null;
|
|
27402
|
-
Tokens
|
|
27403
|
-
Tokens
|
|
27405
|
+
Tokens.CESIUM = options.cesiumToken || void 0;
|
|
27406
|
+
Tokens.GOOGLEMAPS = options.googleMapsToken || void 0;
|
|
27404
27407
|
this.state = new StateDispatcher({
|
|
27405
27408
|
time: { type: "f", value: 0 },
|
|
27406
27409
|
loaded: false,
|
|
27407
|
-
added: false
|
|
27410
|
+
added: false,
|
|
27411
|
+
ready: false
|
|
27408
27412
|
});
|
|
27409
27413
|
this.renderer = new WebGLRenderer({
|
|
27410
27414
|
antialias: true,
|
|
@@ -27443,8 +27447,10 @@ class Viewer extends EventDispatcher {
|
|
|
27443
27447
|
};
|
|
27444
27448
|
this.globeControls.addEventListener("start", this._onGlobeControlsStart);
|
|
27445
27449
|
this.transitionControls = new TransitionControls(this.camera);
|
|
27446
|
-
this.globeManager = new GlobeManager(this.scene, this.camera, this.renderer, { apiToken: Tokens
|
|
27447
|
-
|
|
27450
|
+
this.globeManager = new GlobeManager(this.scene, this.camera, this.renderer, { apiToken: Tokens.CESIUM, googleMapsToken: Tokens.GOOGLEMAPS });
|
|
27451
|
+
if (this.globeManager.tiles) {
|
|
27452
|
+
this.globeControls.setTilesRenderer(this.globeManager.tiles);
|
|
27453
|
+
}
|
|
27448
27454
|
this.cameraCoords = {};
|
|
27449
27455
|
this.pointerCoords = {};
|
|
27450
27456
|
this.pointerXYZ = new Vector3();
|
|
@@ -27493,6 +27499,10 @@ class Viewer extends EventDispatcher {
|
|
|
27493
27499
|
this.sky.material.uniforms.sunPosition.value = sunPosition;
|
|
27494
27500
|
this.pointerRaycaster = new Raycaster();
|
|
27495
27501
|
this._onPointerMove = (event) => {
|
|
27502
|
+
if (!this.globeManager.tiles) {
|
|
27503
|
+
this.pointerCoords = {};
|
|
27504
|
+
return;
|
|
27505
|
+
}
|
|
27496
27506
|
const pointer = {};
|
|
27497
27507
|
pointer.x = event.clientX / window.innerWidth * 2 - 1;
|
|
27498
27508
|
pointer.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
|
@@ -27548,6 +27558,7 @@ class Viewer extends EventDispatcher {
|
|
|
27548
27558
|
this.container.appendChild(this.renderer.domElement);
|
|
27549
27559
|
this.container.appendChild(this.css2DRenderer.domElement);
|
|
27550
27560
|
this.resizeView();
|
|
27561
|
+
this.state.update({ added: true });
|
|
27551
27562
|
this.dispatchEvent({ type: ViewerEvents.APPENDED });
|
|
27552
27563
|
}
|
|
27553
27564
|
updateCameraDirections() {
|
|
@@ -27819,11 +27830,13 @@ class Viewer extends EventDispatcher {
|
|
|
27819
27830
|
let pivot = null;
|
|
27820
27831
|
const raycaster = new Raycaster();
|
|
27821
27832
|
raycaster.setFromCamera({ x: 0, y: 0 }, this.camera);
|
|
27822
|
-
|
|
27823
|
-
|
|
27824
|
-
|
|
27825
|
-
|
|
27826
|
-
|
|
27833
|
+
if (this.globeManager.tiles) {
|
|
27834
|
+
const intersects = raycaster.intersectObject(this.globeManager.tiles.group, true);
|
|
27835
|
+
if (intersects.length > 0) {
|
|
27836
|
+
const intersect = intersects[0];
|
|
27837
|
+
if (intersect) {
|
|
27838
|
+
pivot = intersect.point.clone();
|
|
27839
|
+
}
|
|
27827
27840
|
}
|
|
27828
27841
|
}
|
|
27829
27842
|
if (!pivot) {
|