@inweb/viewer-three 26.12.4 → 26.12.6
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/viewer-three.js +11 -10
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +1 -1
- package/dist/viewer-three.module.js +11 -10
- package/dist/viewer-three.module.js.map +1 -1
- package/lib/Viewer/components/ResetComponent.d.ts +1 -1
- package/package.json +5 -5
- package/src/Viewer/commands/ResetView.ts +0 -5
- package/src/Viewer/components/ResetComponent.ts +5 -2
- package/src/Viewer/controls/JoyStickControls.ts +1 -1
|
@@ -1766,7 +1766,7 @@ class JoyStickControls extends Controls {
|
|
|
1766
1766
|
this.overlayElement.style.position = "fixed";
|
|
1767
1767
|
this.overlayElement.style.zIndex = "0";
|
|
1768
1768
|
this.overlayElement.style.touchAction = "none";
|
|
1769
|
-
|
|
1769
|
+
canvasElement.parentElement.appendChild(this.overlayElement);
|
|
1770
1770
|
this.joyStickCanvas = document.createElement("canvas");
|
|
1771
1771
|
this.joyStickCanvas.id = "joyStickCanvas";
|
|
1772
1772
|
this.joyStickCanvas.width = this.CANVAS_SIZE;
|
|
@@ -2289,7 +2289,6 @@ function regenerateAll(viewer) {
|
|
|
2289
2289
|
}
|
|
2290
2290
|
|
|
2291
2291
|
function resetView(viewer) {
|
|
2292
|
-
const reset = viewer.getComponent("ResetComponent");
|
|
2293
2292
|
viewer.executeCommand("setActiveDragger");
|
|
2294
2293
|
viewer.executeCommand("clearSlices");
|
|
2295
2294
|
viewer.executeCommand("clearOverlay");
|
|
@@ -2298,7 +2297,6 @@ function resetView(viewer) {
|
|
|
2298
2297
|
viewer.executeCommand("showAll");
|
|
2299
2298
|
viewer.executeCommand("explode", 0);
|
|
2300
2299
|
viewer.executeCommand("zoomToExtents", true);
|
|
2301
|
-
reset.resetCameraPosition();
|
|
2302
2300
|
viewer.emit({ type: "resetview" });
|
|
2303
2301
|
}
|
|
2304
2302
|
|
|
@@ -3233,19 +3231,22 @@ class ResetComponent {
|
|
|
3233
3231
|
direction: this.viewer.camera.getWorldDirection(new Vector3()),
|
|
3234
3232
|
};
|
|
3235
3233
|
};
|
|
3234
|
+
this.resetCameraPosition = () => {
|
|
3235
|
+
if (this.savedCameraPosition) {
|
|
3236
|
+
this.viewer.camera.position.copy(this.savedCameraPosition.position);
|
|
3237
|
+
this.viewer.camera.up.copy(this.savedCameraPosition.up);
|
|
3238
|
+
this.viewer.camera.lookAt(this.savedCameraPosition.position.clone().add(this.savedCameraPosition.direction));
|
|
3239
|
+
this.viewer.camera.updateProjectionMatrix();
|
|
3240
|
+
}
|
|
3241
|
+
};
|
|
3236
3242
|
this.viewer = viewer;
|
|
3237
3243
|
this.viewer.addEventListener("databasechunk", this.onDatabaseChunk);
|
|
3244
|
+
this.viewer.on("resetview", this.resetCameraPosition);
|
|
3238
3245
|
}
|
|
3239
3246
|
dispose() {
|
|
3247
|
+
this.viewer.off("resetview", this.resetCameraPosition);
|
|
3240
3248
|
this.viewer.removeEventListener("databasechunk", this.onDatabaseChunk);
|
|
3241
3249
|
}
|
|
3242
|
-
resetCameraPosition() {
|
|
3243
|
-
if (this.savedCameraPosition) {
|
|
3244
|
-
this.viewer.camera.position.copy(this.savedCameraPosition.position);
|
|
3245
|
-
this.viewer.camera.up.copy(this.savedCameraPosition.up);
|
|
3246
|
-
this.viewer.camera.lookAt(this.savedCameraPosition.position.clone().add(this.savedCameraPosition.direction));
|
|
3247
|
-
}
|
|
3248
|
-
}
|
|
3249
3250
|
}
|
|
3250
3251
|
|
|
3251
3252
|
const components = componentsRegistry("threejs");
|